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

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -