Rahul Borole
Rahul Borole

Reputation: 53

htaccess URL executes wrong

I have return the below htaccess rule for actual URL http://apis.jaspee.com/services/srvcRest.php?rqst=getCMS

RewriteRule ^(.*)$ services/srvcRest.php?rqst=$1 [QSA,NC]   

but it works as

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

because of that the page is redirected to page not found page. $1 fetch the value as services/getCMS but I want the $1 should fetch the value as getCMS only.

Upvotes: 1

Views: 28

Answers (1)

Brandon Harris
Brandon Harris

Reputation: 987

If its going in root /.htaccess, try:

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

If its going in /services/.htaccess, try:

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

Upvotes: 1

Related Questions