Rob
Rob

Reputation: 79

.htaccess redirect not working in WordPress 3.5.1 on Apache

I'm trying to fix a canonical issue with WordPress 3.5.1

http://www.whatisanaddiction.com/index.php needs to redirect to http://www.whatisanaddiction.com/ so I don't end up with a duplicate content issue with search engines.

I don't know the code that needs to be used in .htaccess very well but I never had a problem before WordPress' code inserted in the .htaccess.

I've tried all sorts of variations and many cause the whole website to "Server Error".

Here's what I've got so far but it still doesn't redirect the index.php verions correctly.

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

RewriteCond %{THE_REQUEST} ^.*\/index\.php\ HTTP/
RewriteRule ^(.*)index\.php$ /$1 [R=301,L]
    # always www
RewriteCond %{HTTP_HOST} !^www\.whatisanaddiction\.com$ [NC]
RewriteRule ^(.*)$ http://www.whatisanaddiction.com/$1 [L,R=301]

</IfModule>

# END WordPress

Redirect 301 http://www.whatisanaddiction.com/index.php http://www.whatisanaddiction.com/

... I see all sorts of people asking this question online but no "working" solution - so far. Maybe I'm not searching for the right terms???

Any help would be greatly appreciated!

Upvotes: 1

Views: 1369

Answers (2)

Rob
Rob

Reputation: 79

Ok for some strange reason the sample I used above just started working... weird, maybe the server needed some time to "think about it." ??? weird.

Upvotes: 1

Stephen Ostermiller
Stephen Ostermiller

Reputation: 25524

Your arguments for your 301 redirect are not correct. The page you are redirecting from, should not have the domain name on it. Try this instead.

Redirect 301 /index.php http://www.whatisanaddiction.com/

Upvotes: 0

Related Questions