0

I'm kind of new to creating redirects and I need some help with this matter.

I'm trying to redirect a link that looks like http://marpic.pt/query_piscinas.php?modelo=Corredor%20Nata%E7%E3o

And I want to redirect to http://marpic.pt/

I tried with the following code

RewriteCond %{QUERY_STRING} modelo=Corredor%20Nata%E7%E3o
RewriteRule ^query_piscinas\.php$ /$ [L,R=301]

But it doesn't work. What am I doing wrong?

Olaf Dietsche
  • 72,253
  • 8
  • 102
  • 198
besmarques
  • 25
  • 5
  • What does not work mean? Isn't it redirecting? Does Apache crash? Something else? Unrelated, but *never* test with [`R=301`](http://stackoverflow.com/a/9204355/1741542)! – Olaf Dietsche Jan 17 '17 at 16:09
  • Hi olaf Thank you for your reply. It doesn't redirect – besmarques Jan 17 '17 at 16:26
  • Then maybe it's the percent encoding. Does it work, when you test with just `modelo=Corredor` – Olaf Dietsche Jan 17 '17 at 17:43
  • I the case i showed thats a problem of enconding on the link. I tried with others that dont have that problem but it still doesnt work – besmarques Jan 18 '17 at 16:10
  • Another problem might be `/$`, because there's no regular expression in the substitution. Apart from that, you must look into Apache's error logs. – Olaf Dietsche Jan 18 '17 at 16:29
  • I understood what the problem was. Earlier i added an 301 redirect for /query_piscinas.php redirect 301 /query_piscinas.php /piscinas/ And this was what stopping the redirect i was talking but now i need a solution for this one – besmarques Jan 19 '17 at 17:56

0 Answers0