google Webmaster tools strange urls

Hi,
When I check my webmaster tools I have some very odd pages appearing as duplicats. These pages are also accessible, despite not being releveant or existing and not showing properly.

e.g mysite.com/page.php/folder/bfolder/cfolder/sitemap.php?offset=240
or
page.php?offset?offset=480

This resolves to a page but is not linked to. I wonder how I can stop this page exisitng.
mmguideAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dave BaldwinFixer of ProblemsCommented:
It sounds like you are using a CMS that looks up the pages in a database and rewrites the URLs.  If you have a CMS like Joomla or Drupal, you should click on "Request Attention" and get those zones added to your question so those experts will look at your question.  This doesn't sound like an Apache problem.
mmguideAuthor Commented:
Hi,
I am using a self-built php page system that uses a database.

i.e. locationA-page.php URL is written from  page.php?location=locationA
 
in an  .htaccess
Dave BaldwinFixer of ProblemsCommented:
Have you uploaded a sitemap? Google will try to access anything that looks like a URL when it scans your site.  Is there any possibility that your htaccess code could generate two different URLs that map to the same page?
SolarWinds® Network Configuration Manager (NCM)

SolarWinds® Network Configuration Manager brings structure and peace of mind to configuration management. Bulk config deployment, automatic backups, change detection, vulnerability assessments, and config change templates reduce the time needed for repetitive tasks.

mmguideAuthor Commented:
Possibly.
Is there a way to ensure it maps to a specific URL in htaccess?  
(I have  changed all the site  links to the absolute URL)

Should I do this in the htaccess file and if so do you have an examples?
Dave BaldwinFixer of ProblemsCommented:
You can use 'mod_rewrite' to rewrite the URLs but I've never done that partly because I don't really understand the rules.  You would have to click on "Request Attention" above and get some others to look at your question for that.
Tony McCreathTechnical SEO ConsultantCommented:
If Google has indexed it then there's a 99% chance there is a link somewhere using those dodgy URLs

You need to find them and fix them.

Once fixed you have several things you can do to help things along:

setup .htaccess to 301 redirect those dodgy links back to the canonical page
add canonical tags
block the dodgy links in robots.txt
tell Google via WMT to ignore those parameters
virmaiorCommented:
you could 301 based on a pattern in php


function right_url($url)
if ($_SERVER['REQUEST_URI'] != $correct_url) {
 header ('HTTP/1.1 301 Moved Permanently');
  header ('Location: ' . $correct_url);
  exit;
}

right_url('/my_correct_url');
mmguideAuthor Commented:
Hi,
virmaior:
Shouldn't that be:
function right_url($correct_url)
if ($_SERVER['REQUEST_URI'] != $correct_url) {
 header ('HTTP/1.1 301 Moved Permanently');
  header ('Location: ' . $correct_url);
  exit;
}

right_url('/my_correct_url');

Tiggerito:
Finding the dodgy url is very tricky. webmaster tools doesn't make it easy. Any ideas?

mmguideAuthor Commented:
Isn't there a way to redirect anything after  location.php (apart from an offset parameter) to location.php

i.e incorrect url:   mysite.com/location.php/folder/bfolder/
correct url: mysite.com/location.php


mysite.com/location.php?offset=10 (is also a correct url potentially depending on record numbers)
Tony McCreathTechnical SEO ConsultantCommented:
Something like zenu link sleuth can find out if it's an internal link that is causing it.

If it's external export GWTs "Links to your site" table and search it for offset

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
virmaiorCommented:
mmguide -> sorry about the error.

you can do what you want with directory rewriting using ModRewrite.

RewriteEngine On
RewriteRule ^location\.php([^\/+]) /location.php

but this won't know the offset, etc.  Apache does not know those things, so you would need to handle the redirects in php.
mmguideAuthor Commented:
Hi,
virmaior: I have already started using this, which redirects to the php page.

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

Thanks for that but the one you gave reported a  404 error and I think a redirect would work better.

Tiggerito:
Xenu link sleuth works great.
mmguideAuthor Commented:
Xenu help to sort out a few problems and the script I used seemed to solve others.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Apache Web Server

From novice to tech pro — start learning today.