Mobile app version of vmapp.org
Login or Join
Pierce454

: Redirecting previous domain subfolder links I've recently bought a domain that was unregistered. After looking in Google webmaster tools, Google is trying to crawl random pages that don't exist.

@Pierce454

Posted in: #Apache #ModRewrite #Php #Redirects #UrlRewriting

I've recently bought a domain that was unregistered. After looking in Google webmaster tools, Google is trying to crawl random pages that don't exist. Turns out it did have a previous owner.

The offending pages are in the style

mysite.com/catalog/?Brand=0&Model=102&ID=0


Although there doesn't seem to be any links on the web (who knows what the previous owner did) I want these to point to my homepage.

I've tried redirecting using..

redirect 301 /catalog/ mysite.com/

but I end up with a redirect to my homepage with an URL in the address bar of...

mysite.com/?Brand=0&Model=102&ID=0


How do I get it to just redirect to my homepage and show URL mysite.com in the address bar with no gubbings on the end?

I am on an Apache server with PHP 5

Thanks.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Pierce454

1 Comments

Sorted by latest first Latest Oldest Best

 

@Dunderdale272

Simply append a ? to the end of the domain in the redirect rule to prevent the query string from being append to the final redirected url.

RewriteRule ^catalog/.*$ www.mydomain.com? [R=301,L]

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme