help me to write a .htaccess file

Discussion in 'Apache' started by Freewebspace, Nov 18, 2006.

  1. #1
    Freewebspace, Nov 18, 2006 IP
  2. hans

    hans Well-Known Member

    Messages:
    2,923
    Likes Received:
    126
    Best Answers:
    1
    Trophy Points:
    173
    #2
    there might be another thread just about

    mod_rewrite

    and there is the king of mod_rewrite at home
    if you post with proper mod_rewrite subject he may get your attention and help you out - i guess it is quiet simple - but that is his kingdom to reign

    may be something like

    for apache 2.x
    place top level .htaccess ( if you need it top level )


    try above and see
    may be you need to excape the ? as well or the =
    i know little about regex
    hence if all special signs need escaping then the last line could read like

    RewriteRule ^index\.php\?c\=1$ information.html [L]

    but that is pure speculation subject to test or correction by one WHO KNOWS rather than guessing
     
    hans, Nov 18, 2006 IP
    Providence likes this.
  3. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #3
    Options +Indexes
    Options +FollowSymlinks
    RewriteEngine on
    RewriteBase /
    RewriteRule ^([^.]+)\.html$ index.php?c=$1 [L]

    If you got other files in the root with that extention, use something else, like domain.com/#.htm
     
    Nintendo, Nov 18, 2006 IP
  4. Freewebspace

    Freewebspace Notable Member

    Messages:
    6,213
    Likes Received:
    370
    Best Answers:
    0
    Trophy Points:
    275
    #4
    Nintendo

    Whether I should write this for each dynamic page

    that it is index.php?c=999

    Whether Is should also write for 999
     
    Freewebspace, Nov 19, 2006 IP
  5. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #5
    domain.com/999.htm for example. That code changes all of them.
     
    Nintendo, Nov 20, 2006 IP
  6. Freewebspace

    Freewebspace Notable Member

    Messages:
    6,213
    Likes Received:
    370
    Best Answers:
    0
    Trophy Points:
    275
    #6
    Nintendo it does not work s for me

    I want to rewrite the url http://www.annexagain.com/index.php?c=3

    What should I do ,

    I want to know what code i should write for it as either of the above does not work
     
    Freewebspace, Nov 23, 2006 IP