Home htaccess rewrite query string not working as expected
Reply: 0

htaccess rewrite query string not working as expected

user643
1#
user643 Published in June 19, 2018, 6:26 pm

I have the following in my htaccess

RewriteEngine on
RewriteCond %{QUERY_STRING} (^|&)id=3($|&)
RewriteRule ^user/members/profile\.php$ /user/members/profile/id/3?&%{QUERY_STRING}

RewriteCond %{THE_REQUEST} /([^.]+)\.php [NC]
RewriteRule ^ /%1 [NC,L,R]
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^ %{REQUEST_URI}.php [NC,L]

I want the rewrite rules to do two things:

  • Remove .php
  • change user/members/profile.php?id=3 to user/members/profile/id/3

the query string is being redirected to user/members/profile/id/id=3?id=3

Help!

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.33097 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO