url rewriting in htaccess

Discussion in 'PHP' started by rajeeilan, Sep 10, 2007.

  1. #1
    hi,

    i face this situation.

    if anybody type any name in my site i have to redirect them to my index page in a separate folder.

    for example,

    www.example.com/testuser ...then i have to redirect them to...... www.example.com/subfolder/index.php

    pls help
     
    rajeeilan, Sep 10, 2007 IP
  2. Trusttec

    Trusttec Peon

    Messages:
    147
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Trusttec, Sep 10, 2007 IP
  3. techMonster

    techMonster Peon

    Messages:
    20
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Sorry, but I didn't get your problem. Do you want to redirect user to a index page in a fixed folder or will it depend on the name that is entered in URL?
     
    techMonster, Sep 11, 2007 IP
  4. krt

    krt Well-Known Member

    Messages:
    829
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    120
    #4
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule [^/]+ subfolder/index.php [L]
    Code (markup):
    Or if "subfolder" is the name entered in the URL:
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule ([^/]+) $1/index.php [L]
    Code (markup):
     
    krt, Sep 11, 2007 IP