Hi, I'm setting 301 Redirects in the .htaccess of a website. I need to redirect a dynamic url like this: http://www.mysite.com/en/details_links_en.php?catnavid=7639&navpage=1 to http://www.mysite.com The catnavid and the navpage values can change. I've put in the .htaccess: RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ en/details_links_en\.php\?catnavid(.*)&navpage=(.*)\ HTTP/ RewriteRule ^en/details_links_en\.php$ http://www.mysite.com? [R=301,L] But it doesn't work. Can anyone help me? Where am I going wrong? Thanks!
THE_REQUEST is the HTTP request header. example [GET /index.php HTTP/1.1] Is there a reason that you are wanting to test against GET/POST/HEAD etc? If not, then perhaps you want to use REQUEST_URI I might suggest changing your RewriteCond to a different regex such as: RewriteCond %{REQUEST_URI} en/details_links_en\.php\?catnavid=(.*)&navpage=(.*) RewriteRule ^(.*)$ http://www.mysite.com? [R=301,L] I didn't test the above, so please work carefully. I would be interesting in knowing if that fixes your issue.
Hi, thanks for your reply. I've tested your code but unfortunately it still doesn't work. I can't understand why.... Could you suggest me a fix or give me a hint? Thank you!