Mod rewrite help

Discussion in 'Apache' started by DomainMagnate, Jun 19, 2013.

  1. #1
    hey, I'd like to rewrite urls like these:
    from /page.php?var=x to /x
    Could you post the exact .htaccess code for this? thanks
     
    DomainMagnate, Jun 19, 2013 IP
  2. ActiveFrost

    ActiveFrost Notable Member

    Messages:
    2,072
    Likes Received:
    63
    Best Answers:
    3
    Trophy Points:
    245
    #2
    RewriteEngine On
    Options +FollowSymLinks
    
    RewriteRule ^([a-zA-Z0-9-_]+)/?$ page.php?var=$1 [NC,L]
    Code (markup):
     
    ActiveFrost, Jun 19, 2013 IP
  3. vangel

    vangel Active Member

    Messages:
    145
    Likes Received:
    6
    Best Answers:
    2
    Trophy Points:
    98
    #3
    followsymlinks is not needed i believe
     
    vangel, Jun 19, 2013 IP
  4. DomainMagnate

    DomainMagnate Illustrious Member

    Messages:
    10,932
    Likes Received:
    1,022
    Best Answers:
    0
    Trophy Points:
    455
    #4

    thanks, but it's not exactly it. This just adds a redirect, but when I go to /x it just redirects to the old url: /page.php?var=x. I'd like a permanent redirect. So all the old urls are redirected to new ones now.
     
    DomainMagnate, Jun 22, 2013 IP