2013-08-28 3 views
2

Мне нужно было создать новое правило для htaccess. Я написал это. Но я нашел проблему с WSDL. Когда я использую новое правило, у меня есть некоторые проблемы с подключением к WSDL. Я не знаю причин. Но я должен это исправить.Исключить url из rewriterule

Могу ли я написать в 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] 
} 

Благодарим за ответ.

EDIT: это вся моя старая переписывают

<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

Смежные вопросы