找不到 PHP htaccess 重定向页面


PHP htaccess redirect page not found

我有一个网站,我正在使用htaccess规则URL获取数据,但它总是重定向到找不到的页面。如果我使用直接 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>

谁能说我做错了什么?

您不希望将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>