#1
  1. No Profile Picture
    Registered User
    SEO Chat Explorer (0 - 99 posts)

    Join Date
    May 2013
    Posts
    29
    Rep Power
    0

    Question How to www redirect URL?


    I want to know how to www redirect my website URL. Issue is when i type www (dot) mywebsite( dot )com and mywebsite(.)com they opens with different url format as they typed.
  2. #2
  3. No Profile Picture
    Newbie
    SEO Chat Explorer (0 - 99 posts)

    Join Date
    Jun 2014
    Posts
    1
    Rep Power
    0
    A lot of shared hosting servers do that be default. Why is it a problem?
  4. #3
  5. Just a Photographer
    SEO Chat Adventurer (500 - 999 posts)

    Join Date
    May 2011
    Location
    Atwater, CA
    Posts
    752
    Rep Power
    1384
    You can add this to your .htaccess file:

    Code:
    RewriteCond %{HTTP_HOST} !^www\.YourSite\.com$ [NC]
    RewriteRule ^(.*)$ http://www.YourSite.com/$1 [R=301,L]
    When you type in 'YourSite.com' it re-directs it to 'www.YourSite.com'.

    Comments on this post

    • Shobhit Saxena agrees
  6. #4
  7. No Profile Picture
    Registered User
    SEO Chat Explorer (0 - 99 posts)

    Join Date
    May 2013
    Posts
    29
    Rep Power
    0
    Thanks Hikin Mike it works for me
  8. #5
  9. No Profile Picture
    Newbie
    SEO Chat Explorer (0 - 99 posts)

    Join Date
    Aug 2014
    Posts
    1
    Rep Power
    0
    To redirect (say) example.com to Example Domain, add the following code to your .htaccess file.

    RewriteEngine onRewriteCond %{HTTP_HOST} ^example\.com$ [NC]RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]The above code causes the server to check that the domain name portion of the URL is example.com. If it is, the visitor will be sent to Example Domain instead.
    If you also own, say example.co.uk, example.de and/or some other domain, and want them to be redirected to Example Domain as well, you may prefer to use the following code instead:

    RewriteEngine onRewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC]RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]This second set of rules checks to see if the URL has a domain name portion of Example Domain. If it doesn't, the visitor is redirected to Example Domain. In other words, any web address with a domain name component other than Example Domain will cause a redirection to take place.
    Whichever set of rules you use, change all instances of "example.com" to your actual domain name. For the line beginning with RewriteCond, add a backslash ("\") before each of the full stops (or "periods") in your domain name.

    Comments on this post

    • firemonster agrees
  10. #6
  11. No Profile Picture
    Banned
    SEO Chat Explorer (0 - 99 posts)

    Join Date
    Aug 2014
    Posts
    25
    Rep Power
    0
    Thanks Hikin! Will this code work for other websites?
  12. #7
  13. Just a Photographer
    SEO Chat Adventurer (500 - 999 posts)

    Join Date
    May 2011
    Location
    Atwater, CA
    Posts
    752
    Rep Power
    1384
    Originally Posted by melissa01
    Thanks Hikin! Will this code work for other websites?
    Yes, it will work on any website. If you don't have an `.htaccess` file, you can create one using 'Notepad' or 'Notepad++' and save it as `.htaccess`.

Similar Threads

  1. 301 redirect
    By cc seo in forum Google Optimization
    Replies: 3
    Last Post: Aug 21st, 2009, 11:15 AM
  2. Redirect help please
    By georgetai in forum Web Design, Coding and Programming
    Replies: 3
    Last Post: May 27th, 2007, 11:36 AM
  3. 301 Redirect
    By AlexCSI in forum Google Optimization
    Replies: 4
    Last Post: May 25th, 2007, 10:44 PM
  4. 301 redirect or 302 redirect for google
    By rajput_jitendra in forum Google Optimization
    Replies: 10
    Last Post: Jun 6th, 2006, 03:43 AM
  5. 301 redirect:.htaccess and php redirect?
    By lilyfok in forum Google Optimization
    Replies: 3
    Last Post: May 3rd, 2006, 09:46 AM

IMN logo majestic logo threadwatch logo seochat tools logo