1

I've been trying to fix thousands of 404 errors in Google webmaster using htaccess rewrite but not getting anywhere. I read a lot on it but had no luck so far in implementing it successfully.

The errors reported are in this format:

http://sub.example.com/tl/author/admin/page/82
http://sub.example.com/tl/author/admin/page/91
http://sub.example.com/no/author/admin/page/101

These are pages created by a translation plugin which I no longer use. "tl", "no" etc are the language folder.

I want to strip the language folder from the url to make it:

http://sub.example.com/author/admin/page/82

Here is what I entered in htaccess

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteRule ^([A-Za-z][A-Za-z])/author/admin/page/([0-9]+)$ http://sub.example.com/author/admin/page/$2 [L,R=301]
</IfModule>

I tried many variations of rewrite rule but nothing worked. Then I removed all regex and simply used the full url:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^http://sub.example.com/tl/author/admin/page/82$ http://sub.example.com/author/admin/page/82 [L,R=301]
</IfModule>

This didn't work either.

Any suggestions.

4

2 に答える 2

0

your best bet would be to query this with your hosting provider. I have had to deal with hosting providers RE issues like this in the past. Some of the hosting servers somehow manage to restrict/override certain setting found within .htaccess.

An example is a Wordpress site hosted on a Windows server, my one hosts do not allow the .htaccess file to change the permalinks in certain ways....

于 2013-02-05T06:11:37.323 に答える
0

Not sure why it wasn't working. I used "RedirectMatch 301" instead with same Regex and it worked fine.

于 2013-02-11T12:13:43.330 に答える