my mod_rewrite redirection not working...

44 views
Skip to first unread message

angelfire4xx

unread,
Jun 8, 2010, 6:33:35 AM6/8/10
to Only Validation + Navigation = Crawlability
I've just looked at my Google Webmaster tools for the first time in
ages and found many crawl errors. Google seems to think I have 100
backlinks pointing to a non-existent index.html. In fact these
backlinks are just pointing to my root domain http://www.water-retention.net

My site runs on Wordpress. I have spent much time searching for the
right solution for how to redirect index.html to the root,
using .htaccess. I found your great page with the mod_rewrite code to
do this, but sadly I can't get it to work.

Can anyone help? Here is the code I have in .htaccess

<IfModule mod_security.c>
SecFilterInheritance Off
</IfModule>

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

### re-direct any parked domain/subdomain to www of main domain
RewriteCond %{http_host} !^www.water-retention.net$ [nc]
RewriteRule ^(.*)$ http://www.water-retention.net/$1 [r=301,nc,L]

### re-direct index.html to root / ###
RewriteCond %{THE_REQUEST} ^.*\/index\.html\ HTTP/
RewriteRule ^(.*)index\.html$ /$1 [R=301,L]

### re-direct index.htm to root / ###
RewriteCond %{THE_REQUEST} ^.*\/index\.htm\ HTTP/
RewriteRule ^(.*)index\.htm$ /$1 [R=301,L]
</IfModule>

### Redirections from bad URLs###
redirect 301 /waterfall-diet.html http://www.water-retention.net/waterfall-diet/
redirect 301 /idiopathic-edema.html http://www.water-retention.net/water-retention-diet/
redirect 301 /water-retention-causes.html http://www.water-retention.net/causes-of-water-retention/

I'm not a complete newbie, but also not a programmer :-)

webado

unread,
Jun 8, 2010, 7:36:28 AM6/8/10
to Only Validation + Navigation = Crawlability
Hmm, for a WP installation maybe you need a straightforward
redirection like:

Redirect 301 /index.html http://www.water-retention.net/
Redirect 301 /index.htm http://www.water-retention.net/

I cannot test this now, sorry. I will try tonight to run some tests.



On Jun 8, 6:33 am, angelfire4xx <angelfire...@gmail.com> wrote:
> I've just looked at my Google Webmaster tools for the first time in
> ages and found many crawl errors. Google seems to think I have 100
> backlinks pointing to a non-existent index.html. In fact these
> backlinks are just pointing to my root domainhttp://www.water-retention.net
>
> My site runs on Wordpress. I have spent much time searching for the
> right solution for how to redirect index.html to the root,
> using .htaccess. I found your great page with the mod_rewrite code to
> do this, but sadly I can't get it to work.
>
> Can anyone help? Here is the code I have in .htaccess
>
> <IfModule mod_security.c>
> SecFilterInheritance Off
> </IfModule>
>
> <IfModule mod_rewrite.c>
> Options +FollowSymlinks
> RewriteEngine On
> RewriteBase /
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteCond %{REQUEST_FILENAME} !-d
> RewriteRule . /index.php [L]
>
> ### re-direct any parked domain/subdomain to www of main domain
> RewriteCond %{http_host} !^www.water-retention.net$[nc]
> RewriteRule ^(.*)$http://www.water-retention.net/$1[r=301,nc,L]
>
> ### re-direct index.html to root / ###
> RewriteCond %{THE_REQUEST} ^.*\/index\.html\ HTTP/
> RewriteRule ^(.*)index\.html$ /$1 [R=301,L]
>
> ### re-direct index.htm to root / ###
> RewriteCond %{THE_REQUEST} ^.*\/index\.htm\ HTTP/
> RewriteRule ^(.*)index\.htm$ /$1 [R=301,L]
> </IfModule>
>
> ### Redirections from bad URLs###
> redirect 301 /waterfall-diet.htmlhttp://www.water-retention.net/waterfall-diet/
> redirect 301 /idiopathic-edema.htmlhttp://www.water-retention.net/water-retention-diet/
> redirect 301 /water-retention-causes.htmlhttp://www.water-retention.net/causes-of-water-retention/

angelfire4xx

unread,
Jun 8, 2010, 7:51:51 AM6/8/10
to Only Validation + Navigation = Crawlability
Hi, thanks, I tried that but it creates a server error (I read that
it's something to do with creating an infinite loop)


> Redirect 301 /index.htmlhttp://www.water-retention.net/
> Redirect 301 /index.htmhttp://www.water-retention.net/
>

Christina S

unread,
Jun 8, 2010, 8:03:34 AM6/8/10
to only-va...@googlegroups.com
Well I cannot test now anyway.

> --
> You received this message because you are subscribed to the Google Groups
> "Only Validation + Navigation = Crawlability" group.
> To post to this group, send email to only-va...@googlegroups.com.
> To unsubscribe from this group, send email to
> only-validati...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/only-validation?hl=en.
>
Christina
www.webado.net

AnalyticsDude

unread,
Jun 8, 2010, 8:08:46 AM6/8/10
to Only Validation + Navigation = Crawlability
Don't waste your time with .htaccess if you are on Wordpress. Simply
install this Plugin and all your problems will go away.

http://urbangiraffe.com/plugins/redirection/

Let us know how it goes.

Les

PS: The backlinks could be from when your site was not on
Wordpress........


On Jun 8, 6:33 am, angelfire4xx <angelfire...@gmail.com> wrote:
> I've just looked at my Google Webmaster tools for the first time in
> ages and found many crawl errors. Google seems to think I have 100
> backlinks pointing to a non-existent index.html. In fact these
> backlinks are just pointing to my root domainhttp://www.water-retention.net
>
> My site runs on Wordpress. I have spent much time searching for the
> right solution for how to redirect index.html to the root,
> using .htaccess. I found your great page with the mod_rewrite code to
> do this, but sadly I can't get it to work.
>
> Can anyone help? Here is the code I have in .htaccess
>
> <IfModule mod_security.c>
> SecFilterInheritance Off
> </IfModule>
>
> <IfModule mod_rewrite.c>
> Options +FollowSymlinks
> RewriteEngine On
> RewriteBase /
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteCond %{REQUEST_FILENAME} !-d
> RewriteRule . /index.php [L]
>
> ### re-direct any parked domain/subdomain to www of main domain
> RewriteCond %{http_host} !^www.water-retention.net$[nc]
> RewriteRule ^(.*)$http://www.water-retention.net/$1[r=301,nc,L]
>
> ### re-direct index.html to root / ###
> RewriteCond %{THE_REQUEST} ^.*\/index\.html\ HTTP/
> RewriteRule ^(.*)index\.html$ /$1 [R=301,L]
>
> ### re-direct index.htm to root / ###
> RewriteCond %{THE_REQUEST} ^.*\/index\.htm\ HTTP/
> RewriteRule ^(.*)index\.htm$ /$1 [R=301,L]
> </IfModule>
>
> ### Redirections from bad URLs###
> redirect 301 /waterfall-diet.htmlhttp://www.water-retention.net/waterfall-diet/
> redirect 301 /idiopathic-edema.htmlhttp://www.water-retention.net/water-retention-diet/
> redirect 301 /water-retention-causes.htmlhttp://www.water-retention.net/causes-of-water-retention/

angelfire4xx

unread,
Jun 8, 2010, 12:45:43 PM6/8/10
to Only Validation + Navigation = Crawlability
Hi analyticsdude and thanks. The backlinks do not point to the non-
existent index.html, they point only to the root. Many of them are new
and I created some myself from articles etc just recently.

I did find and download the wordpress redirection plugin, but the
documentation doesn't really explain how to use it for this problem. I
don't know what to put in the boxes. If you've used it to redirect to
the root, what did you put in the boxes?

Thanks :-)

Les Faber

unread,
Jun 8, 2010, 1:17:46 PM6/8/10
to only-va...@googlegroups.com
Can you e-mail the CSV file from Webmaster Tools that shows your 404 errors?

The plugin is simple. If (for whatever reason) you have something
pointing to 'index.html' instead of your main URL, you simply put
'index.html' in the first box and the destination URL in the second.
It works like a charm. Plus you get stats on hits etc...

I would like to know how this whole index.html thing started in the first place.

Les

angelfire4xx

unread,
Jun 10, 2010, 7:27:48 AM6/10/10
to Only Validation + Navigation = Crawlability
Well, I finally cracked the redirection. After trying various
mod_rewrite suggestions, and finding that none of them worked, I
thought I'd try putting the redirection code first, before Wordpress'
index.php redirection. That did the trick. Everything fine now. Here's
the final .htaccess

<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On

### re-direct any parked domain/subdomain to www of main domain###
RewriteCond %{http_host} !^www.water-retention.net$ [nc]
RewriteRule ^(.*)$ http://www.water-retention.net/$1 [r=301,nc,L]

### re-direct index.html to root ###
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.html\ HTTP/
RewriteRule ^index\.html$ http://www.water-retention.net/ [R=301,L]

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

webado

unread,
Jun 10, 2010, 8:12:19 AM6/10/10
to Only Validation + Navigation = Crawlability
Excellent. Glad it's sorted.

On Jun 10, 7:27 am, angelfire4xx <angelfire...@gmail.com> wrote:
> Well, I finally cracked the redirection. After trying various
> mod_rewrite suggestions, and finding that none of them worked, I
> thought I'd try putting the redirection code first, before Wordpress'
> index.php redirection. That did the trick. Everything fine now. Here's
> the final .htaccess
>
> <IfModule mod_rewrite.c>
> Options +FollowSymlinks
> RewriteEngine On
>
> ### re-direct any parked domain/subdomain to www of main domain###
> RewriteCond %{http_host} !^www.water-retention.net$[nc]
> RewriteRule ^(.*)$http://www.water-retention.net/$1[r=301,nc,L]
>
> ### re-direct index.html to root ###
> RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.html\ HTTP/
> RewriteRule ^index\.html$http://www.water-retention.net/[R=301,L]
Reply all
Reply to author
Forward
0 new messages