Reputation: 159
I have the htacess file in the root of a WordPress website (http://www.raynauds.org). I need to redirect all calls to:
http://www.raynauds.org/?p=2366
to:
I am running Apache on a Linxus Server. The code below seems to be doing nothing to redirect the request. What am I doing wrong?
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
Redirect 301 /?p=2366 http://www.raynauds.org/2012/08/11/dr-maureen-mayes-joins-raynauds-association-medical-advisory-board/
Upvotes: 0
Views: 64
Reputation: 757
Rewrite and Redirect are both applied to the URL before looking for the file to be executed.
Your RewriteRules both have the [L] flag stating that this will be the last Rule to modify the URL, so the Redirect will not be used for URLs matching one of the RewriteRules.
As the second RewriteRule will catch all requests your Redirect will not work. You can also redirect with a RewriteRule like
RewriteCond %{QUERY_STRING} p=2366
RewriteRule . http://www.example.com [R=301,L]
Please also look at the available flags in the Manual
Of course this rule should go before RewriteCond/RewriteRule lines of Wordpress itself to work.
Upvotes: 1
Reputation: 1509
Move your Redirect 301
rule to the line below the RewriteBase
statement.
Upvotes: 0