John Kim
John Kim

Reputation: 1872

301 redirect on .htaccess not working with Wordpress

I've got below 301 redirect the bottom one I would like to get it working but it's not working at the moment.

# BEGIN WordPress
<IfModule mod_rewrite.c>
Options +FollowSymLinks
Options +Indexes
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
RewriteCond %{HTTP_HOST} ^domain.com.au$
RewriteRule ^/?$ "http\:\/\/www\.domain\.com\.au\/" [R=301,L]
RewriteRule ^author/privacy?$ privacy [R=301,L]

Is there a reason why?

I would like to redirect author/privacy to privacy...

Upvotes: 2

Views: 3240

Answers (2)

anubhava
anubhava

Reputation: 784898

Order of the rules is of problem here. Here is the fixed version:

# BEGIN WordPress
<IfModule mod_rewrite.c>

Options +FollowSymLinks +Indexes
RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} ^domain\.com\.au$ [NC]
RewriteRule ^$ http://www.domain.com.au/ [R=301,L]

RewriteRule ^author/(privacy)/?$ /$1 [R=301,L,NC]

RewriteRule ^index\.php$ - [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

</IfModule>
# END WordPress

Upvotes: 1

Mikeys4u
Mikeys4u

Reputation: 1552

Just had the same problem, but this is the answer..... Use relative URL's not full http:// etc. Cut the below code and add to your .htaccess file and add to your root directory

Redirect 301 /page1.php /page2.html
Redirect 301 /page3.php /page4.html


 <IfModule mod_rewrite.c>
 RewriteEngine On
 RewriteBase /
 RewriteRule ^index\.php$ - [L]
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule . /index.php [L]
 </IfModule>

Upvotes: 0

Related Questions