找不到PHP htaccess重定向页面

时间:2016-02-24 06:09:47

标签: php .htaccess

我有一个网站,我使用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>

有谁能说我在做什么?

1 个答案:

答案 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>