apache - htaccess - how to redirect url with params to base url -


i trying redirect page.html params @ end base url without params. know supposed use mod rewrite can't rules figured out. appreciated.

here scenario: tried in htaccess , rule didn't work:

redirect 301 "/page.html?p=2" http://www.domain.com/page.html 

i understand reading other posts on stackoverflow should write like

^page\.html$ http://www.domain.com/page.html [qsa,nc,r=301,l] 

the rules @ end [qsa,nc,r=301,l] incorrect. can't figure out. want 301 url p=2 parameter, , no other param.

and process remaining rules after rule other pages.

you can put code in root htaccess

rewriteengine on  rewritecond %{query_string} ^p=2$ [nc] rewriterule ^page\.html$ /page.html? [r=301,l] 

Comments

Popular posts from this blog

command line - Use qwinsta in PowerShell ISE -

java - Incorrect order of records in M-M relationship in hibernate -

Python website log in: BIG-IP can not find session information in the request -