我有一个网站,我使用htaccess规则获取数据,但它总是重定向到找不到的页面。如果我使用直接URL而不是htaccess url,那么它可以正常工作。
好的网址:http://apis.jaspee.com/services/getCMS?pageid=2
真实网址:http://apis.jaspee.com/services/srvcRest.php?rqst=getCMS&pageid=2
.htaccess
代码:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-s
RewriteRule ^(.*)$ srvcRest.php?rqst=$1 [QSA,NC,L]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.*)$ srvcRest.php [QSA,NC,L]
RewriteCond %{REQUEST_FILENAME} -s
RewriteRule ^(.*)$ srvcRest.php [QSA,NC,L]
</IfModule>
<Limit GET POST PUT DELETE>
Allow from all
</Limit>
有谁能说我在做什么?
答案 0 :(得分:1)
您不希望services/
被发送到您的rqst
参数:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-s
RewriteRule ^services/(.*)$ services/srvcRest.php?rqst=$1 [QSA,NC,L]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^services/(.*)$ services/srvcRest.php [QSA,NC,L]
RewriteCond %{REQUEST_FILENAME} -s
RewriteRule ^services/(.*)$ services/srvcRest.php [QSA,NC,L]
</IfModule>
<Limit GET POST PUT DELETE>
Allow from all
</Limit>