rewrite urls

Discussion in 'PHP' started by srdva59, Jul 21, 2010.

  1. #1
    hi,
    i need to rewrite my urls for sef/seo.
    i already does that but was some time ago and i don´t remember how...
    want i need to do is when a user enter this links:
    www.teste.com/name
    the apache is working with this url:
    www.teste.com/index.php?folder=name
    i know that i need change the htacess but i don´t remember
    what i need to change
    thanks a lot for your help
    :)
     
    srdva59, Jul 21, 2010 IP
  2. bencummins

    bencummins Peon

    Messages:
    55
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Put this in you .htaccess file


    RewriteEngine On
    RewriteRule ^(.*)$ /index.php?folder=$1
     
    bencummins, Jul 21, 2010 IP
  3. dacash

    dacash Peon

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I would put this in the .htaccess

    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ /index.php?folder=$1

    This way it will only rewrite if the file or folder don't exists, sometimes you want to be able to access files or folder directly.
     
    dacash, Jul 21, 2010 IP