Need to redirect any subdomain to my home page

Discussion in 'Apache' started by CreationMoney.com, Dec 27, 2009.

  1. #1
    Hi all

    my old site http://l9l.org

    was a free hosting

    so I have many

    sub domain in google

    http://www.google.jo/search?hl=ar&source=hp&q=site:l9l.org&meta=&aq=f&oq=


    so when you enter any sub domain

    http://alshroukschool.l9l.org/
    http://a1ama1.l9l.org/vb/
    http://www.islama.l9l.org/

    it take to a

    Internet Explorer cannot display the webpage


    what is the perfect way to add somthing in my htaccess

    so it automaticly take me to http://l9l.org

    and it not logic to redirect each subdomain to my home page manual because they are too much
     
    CreationMoney.com, Dec 27, 2009 IP
  2. CreationMoney.com

    CreationMoney.com Active Member

    Messages:
    181
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    86
    #2
    I really need to help me
     
    CreationMoney.com, Dec 27, 2009 IP
  3. tolra

    tolra Active Member

    Messages:
    515
    Likes Received:
    36
    Best Answers:
    1
    Trophy Points:
    80
    #3
    In your .htaccess
    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^l9l\.org [NC]
    RewriteRule (.*) http://l9l.org/$1 [R=301,L]
    
    Code (markup):
    This assumes all the subdomains map to a directory somewhere on your server, if the subdomains don't exist on the new server then you need to set up a wild card entry, your host can do that for you.
     
    tolra, Dec 28, 2009 IP
  4. CreationMoney.com

    CreationMoney.com Active Member

    Messages:
    181
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    86
    #4
    I try to add this but nothing happen
    what I must say for my host company exactly
     
    CreationMoney.com, Dec 28, 2009 IP
  5. tolra

    tolra Active Member

    Messages:
    515
    Likes Received:
    36
    Best Answers:
    1
    Trophy Points:
    80
    #5
    Then I'm guessing you don't have the subdomains hosted.

    Ask your host to set up your account so that anything.yourdomain.com resolves to the home page of your site, after that the .htaccess should work.
     
    tolra, Dec 29, 2009 IP
  6. CreationMoney.com

    CreationMoney.com Active Member

    Messages:
    181
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    86
    #6
    I fix it by makin a sub domain called

    *.l9l.org

    and put in the folder puplic html l9l.org :)
     
    CreationMoney.com, Dec 31, 2009 IP