U. D.
U. D.

Reputation: 69

I'm having an issue with my .htaccess redirection

I need to use this url http://yoursite.com/proprietes.php?viewid&mls=[18348939] but I wan it to go on a pdf a-very-new-post.pdf. I want to do a redirection in the htaccess. It is not working... I'm in wordpress thanks!

RewriteEngine On
Redirect 301 /proprietes.php?viewid&mls=[18348939]$ http://yoursite.com/a-very-new-post.pdf

Upvotes: 1

Views: 18

Answers (1)

anubhava
anubhava

Reputation: 784918

Redirect or RewriteRule directives cannot match query string. Use a RewriteCond instead like this:

RewriteEngine On

RewriteCond %{THE_REQUEST} \s/proprietes\.php\?viewid&mls=\[?18348939\]? [NC]
RewriteRule ^ /a-very-new-post.pdf? [L,B,R=301]

RewriteCond %{THE_REQUEST} \s/en/proprietes\.php\?viewid&mls=\[?18348939\]? [NC]
RewriteRule ^ /a-very-new-post-english.pdf? [L,B,R=301]

Upvotes: 1

Related Questions