我必须为 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]