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.

htaccess 301 redirect

Discussion in 'Apache' started by deriklogov, Sep 18, 2014.

  1. #1
    I know that probably this question already been asked but I cant find answer on it.
    I need to do, needs to be done thru .htaccess:

    redirect domain from non www to www including all sub folders
    so it someone types domain.com/test1 it should be redirected to www.domain.com/test1

    and redirect all subdomains on domain to their folders

    so if subdomain is test1.domain.com it should be redirected to www.domain.com/test1

    Please help, I need it urgent
    deriklogov, Sep 18, 2014 IP
  2. Krellen

    Krellen Greenhorn

    Likes Received:
    Best Answers:
    Trophy Points:
    RewriteEngine on
    RewriteBase /
    # Force WWW
    RewriteCond %{HTTP_HOST} ^domain.com$
    RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]
    Code (markup):
    Krellen, Sep 21, 2014 IP