htaccess & subdomains

Discussion in 'Apache' started by rebz01, Jun 19, 2010.

  1. #1
    i have a problem with my rewrite and i dont know what it is

    example
    http://stats.tehclan.net/player.php?pid=264609321 is working but displays wrong
    i want it to appear like it does in that url instead of
    http://tehclan.net/bf2statistics/player.php?pid=264609321

    the code i am using is
      #Options +FollowSymlinks
      RewriteCond %{HTTP_HOST} ^stats\.tehclan\.net$ [NC]
      RewriteRule ^(.*)$ http://tehclan.net/bf2statistics/$1 [L,R]
      
      RewriteCond %{HTTP_HOST} ^forum\.tehclan\.net$ [NC]
      RewriteRule ^(.*)$ http://tehclan.net/forum/$1 [L,R]
      
      RewriteCond %{HTTP_HOST} ^rebz01\.tehclan\.net$ [NC]
      RewriteRule ^(.*)$ http://tehclan.net/rebz01/$1 [L,R]
    Code (markup):
    where am i going whong here?
    i want the subdomain to show in the address bar instead of the actual path
     
    rebz01, Jun 19, 2010 IP
  2. madaboutlinux

    madaboutlinux Member

    Messages:
    250
    Likes Received:
    7
    Best Answers:
    2
    Trophy Points:
    43
    #2
    This is the code that is redirecting the sub-domain to the main domain. The first line in the above code check for any request coming at the sub-domain and if it detects it, it redirects it to the main domain URL. If you remove it, you should see the sub-domain in the address bar.
     
    madaboutlinux, Jun 20, 2010 IP
  3. roopajyothi

    roopajyothi Active Member

    Messages:
    1,302
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    80
    #3
    For what you're doing this?
    To prevent hot linking???
     
    roopajyothi, Jun 20, 2010 IP
  4. rebz01

    rebz01 Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    not to prevent anything

    i just think stats.tehclan.net
    looks better than tehclan.net/bf2statistics

    its just preference
    and i want it to show in the address bar too

    ====edit====
    ok so i tried removing the firs lines (i dont know if i fully understood what you were saying)
    removed => RewriteCond %{HTTP_HOST} ^stats\.tehclan\.net$ [NC]

    and it just stops the site from loading at all
     
    Last edited: Jun 20, 2010
    rebz01, Jun 20, 2010 IP
  5. rebz01

    rebz01 Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    any1 have a solution?
     
    rebz01, Jun 21, 2010 IP
  6. rebz01

    rebz01 Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    guess not k thx ill try sumwhere else
     
    rebz01, Jun 22, 2010 IP