0

Google is somehow indexing some phantom URL's for my website. I'm still trying to find the problem.

For example, everything in bold below is NOT supposed to be there.

http://www.mydomain.com/directory/sights?/kauai/sights/sights/kalalau_lookout

It should look like this: http://www.mydomain.com/directory/sights

How can I strip out the ? mark in addition to everything after it and make it 301 redirect to the proper page?

Thanks, John

2
  • Are your URLs really flat or are you using .htaccess rewrite already?
    – ChrisW
    Commented Jan 11, 2013 at 16:55
  • I'm already using htaccess to remove index.php from the URLs Commented Jan 11, 2013 at 17:02

1 Answer 1

0

From mod_rewrite

Modifying the Query String
By default, the query string is passed through unchanged.
...
When you want to erase an existing query string, end the substitution string with just a question mark.
...

You can remove all query strings with

RewriteEngine On
RewriteCond %{QUERY_STRING} .
RewriteRule .* http://www.mydomain.com$0?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.