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.

redirect http://*.example.com to http://www.example.com/*

Discussion in 'Apache' started by FFMG, May 9, 2013.

  1. #1
    FFMG, May 9, 2013 IP
  2. RoseHosting

    RoseHosting Well-Known Member

    Messages:
    230
    Likes Received:
    11
    Best Answers:
    11
    Trophy Points:
    138
    #2
    Create a .htaccess file containing the following lines:

    RewriteEngine on
    
    RewriteCond %{HTTP_HOST} ^example\.com [NC]
    RewriteRule (.*) http://www.example.com/$1 [L,R=301]
    RewriteCond %{HTTP_HOST} !^(www\.)?example\.com [NC]
    RewriteCond %{HTTP_HOST} ^(.*)\.example\.com
    RewriteRule ^(.*)$ http://example.com/%1/$1 [L,NC,QSA]
    Code (markup):
    Don't forget to change 'example.com' with your actual domain name.
     
    RoseHosting, May 9, 2013 IP