Reputation: 123
I'm getting 403 Access Forbidden error for certain urls. I found the root cause of the issue. wherever there is a dot(.) in an url, i'm getting the 403 forbidden.
There are thousands of urls have been indexed by google and hence i wanted to resolve via htaccess.
For e.g
I want to remove (dot) for the following url
FROM
http://www.example.com/zero/one/two/three/four/five/six./seven/eight.html
TO
http://www.example.com/zero/one/two/three/four/five/six/seven/eight.html
Upvotes: 1
Views: 381
Reputation: 1034
mod rewrite should be able to do that:
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^([^.]*)\.([^.]*)\.?([^.]*)?\.?([^.]*)?\.?([^.]*)?(\.html|php|asp|otherextenstionsdesiredhere$) $1$2$3$4 [NC]
Should allow for 1 to 3 periods being removed at a time. If you need more just repeat it a bit more. If it is only 1 period at most, get rid of part of it. You can test it at http://regexpal.com/ and read more about rewrite at http://corz.org/serv/tricks/htaccess2.php
Upvotes: 1