1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How Do I Redirect All Traffic to www.MySite.com?

Discussion in 'Apache' started by Masterful, Oct 19, 2012.

  1. #1
    If I visit my home page by entering example.com into my browser's address bar, my home page URL is example.com.

    If I visit my home page by entering www.example.com into my browser's address bar, my home page URL is www.example.com.

    If I visit my home page by clicking on an internal link, my home page URL is www.example.com/index.php.

    Isn't this bad for the search engines?

    Shouldn't I redirect all traffic to www.example.com?

    If so, how do I do it in an SEO-friendly way?
     
    Last edited: Oct 19, 2012
    Masterful, Oct 19, 2012 IP
  2. pr0t0n

    pr0t0n Well-Known Member

    Messages:
    243
    Likes Received:
    10
    Best Answers:
    10
    Trophy Points:
    128
    #2
    You can 301 redirect all visitors from non-www to www version of your domain name using the following snippet that you need to place in your .htaccess file:
    
    RewriteEngine On
    RewriteBase /
    
    RewriteCond %{HTTP_HOST} !^www\.
    RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
    
    Code (markup):
    Please note: If you already have the first two lines, then just skip those and DO NOT paste them again.

    As for your index.php version of url... I don't think that could be a problem, almost any site has index.html or index.php or default.htm or whatever their index page is. But I guess something could be theoretically done on that end also...

    Cheers.
     
    pr0t0n, Oct 19, 2012 IP
    Masterful likes this.