2

Anybody can help and show me how to remove dots from url (without the last dot of the ".html") in .htaccess

The reason that I have more than 3000 listings ending with " L.L.C. " and after upgrading phpmydirectory I removed all the dots from listing friendly urls,

Now there are 3000 404 error in Google and my listings ranking is down,

For example , in my system:

www.mydomain.com/company-name-llc.html

and in Google:

www.mydomain.com/company-name-l.l.c..html

I just need away to redirect the url witout dots or remove the dots from url and also witout loosing the last dot of .html

I tried this:

RewriteRule ^([^.]*)\.([^.]*)\.?([^.]*)?\.?([^.]*)?\.?([^.]*)?(\.html|php$) $1$2$3$4 [NC]

But it was making a 404 error on all pages in my site.

Please if anybody can help herel, so everybody can get benefit in the same issue.

4

2 回答 2

0

此规则可能不起作用的原因:

RewriteRule ^([^.]*)\.([^.]*)\.?([^.]*)?\.?([^.]*)?\.?([^.]*)?(\.html|php$) $1$2$3$4 [NC]

是您有 6 个捕获组,但只有其中 4 个反向引用。

一个更简单的规则是:

RewriteRule ^([^/]*)\.([^/]*)\.html$ /$1$2.html [L,R=301]

这将循环直到不再有杂散点。

于 2013-09-09T14:20:41.907 回答
0

试试这个并将这条线放在你htaccess位于根目录中

RewriteEngine on
RewriteRule (.*)\.\.html$ /$1.html [R=301,L]
于 2013-09-09T12:55:05.187 回答