I have a strange situation occurring on my site where google thinks certain php pages are children of other php pages. For example, I am getting errors in Google Webmaster tools for pages showing up like: http://domain.com/page1.php/page5.php. Both page1.php and page5.php exist on the site, but I can't figure out why google thinks one should be concatenated to the other.
Browsing to such a link will load page1.php, but not correctly. My goal was to use .htaccess (or other suggestions) to simply redirect to the first page if additional pages follow. Am I thinking about this correctly, and can anyone offer suggestions to help me resolve this? Thanks!
Update: The only lines in my .htaccess file are redirecting from a previous folder structure to a single php file, but this has been in place for at least a year. For example:
RedirectMatch 301 ^/widgets/?$ http://firesage.com/widgets.php
Update2: I just found this 'Soft 404' error in Webmaster tools: http://domain.com/page2.php/include/include/lookup.php?id=22. First, I have the include folder excluded via robots.txt. And the fact that the include folder is listed twice in the url is very suspect.
Look for links to
page1.php/
instead ofpage1.php
.If google (or a browser) follows a link to
page1.php/
, the webserver willl deliver the "correct" filepage1.php
, but google will think thatpage1.php
is a directory and therefore interpret relative links (topage2.php
) like they start from an index file in the "directory"page1.php
.Generally you can use
.htaccess
to redirect Google, but I would rather suggest you find the reason why Google sees those "wrong" links (s. Jeroen's comment to your question). Here's the.htaccess
to start up with, until you've found the reason.Update
If you also need to pass any possible
GET
parameters, just add theQSA
flag so it becomes[R=301,L,QSA]
.I'm not an expert at all on .htaccess, but maybe your redirection rules are confused. To make a redirect, simply use this in your .htaccess:
Does your .htaccess looks like that ? Could you update your question with it ?