How to rewrite Subdomain to file...? PLS HELP ME

Discussion in 'Apache' started by colombo, Apr 7, 2007.

  1. #1
    Hello,

    Here what i want to rewrite:

    http://sub.domain-name.com/variable

    TO

    http://www.domain-name.com/file-name.php?a=variable

    the subdomain is excisting, its a vitual sub domain.

    pls help me.

    thanks, Oren.
     
    colombo, Apr 7, 2007 IP
  2. abdussamad

    abdussamad Active Member

    Messages:
    543
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #2
    Try placing this in the subdomain directory .htaccess file:

    
    rewriteengine on
    rewritebase /
    rewriterule (.*)$ http://www.domain.com/file_name.php?a=$1 [r=301,NC,l]
    
    
    Code (markup):
     
    abdussamad, Apr 7, 2007 IP
  3. colombo

    colombo Active Member

    Messages:
    136
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    85
    #3
    Thanks for the help man.

    i tried it and it work, BUT it change the URL.

    i want it to stay with the URL http://sub.domain.com/a


    can you help me with that...?

    i just want that the URL to stay as is and not redirect.

    Thanks
     
    colombo, Apr 7, 2007 IP
  4. abdussamad

    abdussamad Active Member

    Messages:
    543
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #4
    In that case try this (again in subdomain dir):

    
    rewriteengine on
    rewritebase /
    rewriterule (.*)$ /path/to/file_name.php?a=$1 [NC,l]
    
    Code (markup):
     
    abdussamad, Apr 7, 2007 IP
  5. colombo

    colombo Active Member

    Messages:
    136
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    85
    #5
    its not working

    here take a look

    here is my code:

    rewriteengine on
    rewritebase /
    
    rewriterule (.*)$ http://www.net-games.biz/new_online_games.php?current=$1 [NC,l]
    Code (markup):
    and here you can test it:

    http://1.net-games.biz/1

    the only problem is that the URL is changing and i want it to stay
    http://1.net-games.biz/1

    thanks for your help, again :)
     
    colombo, Apr 7, 2007 IP