Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jun 2010
    Posts
    132
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Redirect Website

    My website can be accessed from different URLs and IPs. For Example it can be accessed by:
    mirror1.com/~mysite/
    mirror2.com/~mysite/
    123.123.123.123/~mysite/
    mirror3.com/~mysite/

    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

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,861
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Try
    Code:
    RewriteEngine On
    
    RewriteCond %{HTTP_HOST} !^www\.example\.com
    RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •