.htaccess Question

Discussion in 'PHP' started by cancer10, Sep 27, 2007.

  1. #1
    cancer10, Sep 27, 2007 IP
  2. sky22

    sky22 Guest

    Messages:
    59
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Seems to be same as this thread. According to that thread you can't do it with a .htacess file.

    Sky22
     
    sky22, Sep 27, 2007 IP
  3. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #3
    nico_swd, Sep 27, 2007 IP
  4. sabmalik

    sabmalik Peon

    Messages:
    33
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    sabmalik, Sep 27, 2007 IP
  5. krt

    krt Well-Known Member

    Messages:
    829
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    120
    #5
    Enable it using a server alias as discussed in the above links or if you are on a shared host and have CPanel or something similar, you can add *.example.com in the subdomain manager.

    Then in your .htaccess:

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^(.+)\.example\.com [NC]
    RewriteRule .* /profiles.php?user=%1 [R=301,L]
     
    krt, Sep 27, 2007 IP
  6. cancer10

    cancer10 Guest

    Messages:
    364
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    cancer10, Sep 27, 2007 IP
  7. sabmalik

    sabmalik Peon

    Messages:
    33
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    this one isnt a problem

    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ profile.php?user=$1 [QSA]
     
    sabmalik, Sep 28, 2007 IP