View Full Version : Redirect Website

Tony M
02-24-2011, 04:35 PM
My website can be accessed from different URLs and IPs. For Example it can be accessed by:

And (for an Unknown reason) My website can be accessed from many different URLs (and some that I do not even know their URLs)
Search engines begins to crawl some different url versions of My site, and begins to Ban My site....

BUT My main website that I want users to visit is: www.example.com

So My question is:
I want to redirect 301 (by using .htaccess) all requests from http://all-urls-and-ips/~mysite/ to http://www.example.com/ (that is My site). So how can I do this?

Any Suggestions Will Be Helpful :thumbsup:

02-25-2011, 09:54 AM
RewriteEngine On

RewriteCond %{HTTP_HOST} !^www\.example\.com
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]