2013-08-28 30 views
2

我必須爲htaccess創建新規則。我寫的。但是我發現WSDL存​​在問題。當我使用新規則時,我遇到了連接到WSDL的問題。我不知道原因。但我必須解決它。從重新編寫排除網址

我可以在htaccess的東西寫如(僞):

if (http://www.mywebsite.com/mywebaplication/src/webServiceInstances.php?someGetParam) { 
    RewriteRule ^([^\/]*)$ index.php?route=$1 [QSA] 
} else { 
    (RewriteRule...) 

    RewriteRule ^([a-zA-Z]+)\.(html|xml|json|jhtml)$ public/index.php?module=$1&controller=Index&action=index&format=$2 [QSA] 
    RewriteRule ^([a-zA-Z]+)$ public/index.php?module=$1&controller=Index&action=index&format=html [QSA] 
} 

感謝答覆。

編輯:這是我的整個老改寫

<IfModule mod_rewrite.c> 
RewriteEngine On 

#php public/index.php -mconfigure 
RewriteBase /webaplication/src/ 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 

RewriteRule ^([^\/]*)$ index.php?route=$1 [QSA] 

</IfModule> 

這是我全新改寫

<IfModule mod_rewrite.c> 
RewriteEngine On 

#php public/index.php -mconfigure 
RewriteBase /mywebaplication/src/ 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 

#new way: module  controller method   format 

RewriteRule ^([a-zA-Z]+)/([a-zA-Z]+)/([a-zA-Z]+)\.(html|xml|json|jhtml)$ public/index.php?module=$1&controller=$2&action=$3&format=$4 [QSA] 
RewriteRule ^([a-zA-Z]+)/([a-zA-Z]+)/([a-zA-Z]+)$ public/index.php?module=$1&controller=$2&action=$3&format=html [QSA] 

RewriteRule ^([a-zA-Z]+)/([a-zA-Z]+)\.(html|xml|json|jhtml)$ public/index.php?module=$1&controller=$2&action=index&format=$3 [QSA] 
RewriteRule ^([a-zA-Z]+)/([a-zA-Z]+)$ public/index.php?module=$1&controller=$2&action=index&format=html [QSA] 

RewriteRule ^([a-zA-Z]+)\.(html|xml|json|jhtml)$ public/index.php?module=$1&controller=Index&action=index&format=$2 [QSA] 
RewriteRule ^([a-zA-Z]+)$ public/index.php?module=$1&controller=Index&action=index&format=html [QSA] 

#old way(this works for wsdl) 
RewriteRule ^([^\/]*)$ index.php?route=$1 [QSA] 

回答

1

替換所有的代碼與此:

Options +FollowSymLinks -MultiViews 
# Turn mod_rewrite on 
RewriteEngine On 
RewriteBase /webaplication/src/ 

RewriteRule ^(webServiceInstances\.php)$ index.php?route=$1 [QSA,L,NC] 

# set default FMT to html 
SetEnvIf Request_URI "^" FMT=html 
# if a format is provided in URI then overwrite default FMT 
SetEnvIf Request_URI "\.([^.]+)$" FMT=$1 

RewriteRule ^([^/]+)/([^/]+)/([^/.]+)(?:\.(?:html|xml|json|jhtml)|/?)$ public/index.php?module=$1&controller=$2&action=$3&format=%{ENV:FMT} [NC,L,QSA] 

RewriteRule ^([^/]+)/([^/.]+)(?:\.(?:html|xml|json|jhtml)|/?)$ public/index.php?module=$1&controller=$2&action=index&format=%{ENV:FMT} [L,NC,QSA] 

RewriteRule ^([^/.]+)(?:\.(?:html|xml|json|jhtml)|/?)$ public/index.php?module=$1&controller=Index&action=index&format=%{ENV:FMT} [L,NC,QSA] 
+0

好的謝謝。這有幫助。 –

+0

不客氣,很高興它爲你解決。 – anubhava