开发者

.htaccess: Strange url have slash / at the end of urls, and .php

I have check google webmaster tools and see lot of URLs that has been crawled, they look like:

mydomain.com/somefile.php/index.php 
or 
mydomain.com/somefile.php/somefilesss.php?aaa=bbb&ddd=ddd
or
mydomain.com/somefile.php/someffiiii.php?iii=uuu/somefilesss.php?aaa=bbb&ddd=ddd

This is really strange. Look like someone add the slash to URL when enter address bar, then google following them. Currently I get fix by remove slash at the end of URLs by this .htaccess:

If it come like .php/, it will become .php

RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ $1 [R=301]

But the issue is other URL still remain in google index. I need solution to redirect the URLs which have trailing slash after php then have other file path to come back to original.

I need help to redirect eg:

mydomain.com/som开发者_开发百科efile.php/somefilesss.php?aaa=bbb&ddd=ddd 

to

mydomain.com/somefile.php

Thanks for any advices.


There are 2 possible explanations to this:

  1. Fantastic: somethere in the web, this links exist and google follows them;
  2. Realistic: there is a bug somethere in your php engine, which produces such links and google follows them.

So IMHO you should not care about creating a rewrite rule, but check php engine for this bug.

As time passes google will "forget" previously collected urls.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜