htaccess URL执行错误

时间:2016-02-24 12:16:06

标签: .htaccess mod-rewrite

我已为实际网址http://apis.jaspee.com/services/srvcRest.php?rqst=getCMS

返回以下htaccess规则
RewriteRule ^(.*)$ services/srvcRest.php?rqst=$1 [QSA,NC]   

但它可以作为

http://apis.jaspee.com/services/srvcRest.php?rqst=services/getCMS

因为该页面被重定向到页面未找到页面。 $ 1获取值作为services / getCMS,但我希望$ 1应该仅将值作为getCMS获取。

1 个答案:

答案 0 :(得分:1)

如果它在root /.htaccess中,请尝试:

RewriteCond %{REQUEST_URI} !^.*/srvcRest\.php$ [NC]
RewriteRule ^services/(.*)$ services/srvcRest.php?rqst=$1 [QSA,NC]

如果进入/services/.htaccess,请尝试:

RewriteCond %{REQUEST_URI} !^.*/srvcRest\.php$ [NC]
RewriteRule ^(.*)$ srvcRest.php?rqst=$1 [QSA,NC]