Page 1 of 1

mod_rewrite / .htaccess / regex help

Posted: Thu Oct 30, 2008 10:54 am
by alexandruc
Hello,

I am new with this stuff so please be gentle with me :)

I have this structure on my WAMP server with mod_rewrite enabled:
http://localhost/sitename/index.php
http://localhost/sitename/page.php?name=something
http://localhost/sitename/info.php?id=something-else

in the .htaccess i have the following code:

Code: Select all

Options +FollowSymLinks
RewriteEngine on
 
RewriteBase /
 
Rewriterule ^sitename/page/([^/])/?$ sitename/page.php?name=$1 [L]
Rewriterule ^sitename/info/([^/])/?$ sitename/info.php?id=$1 [L]
 
shouldn't it work?
accordingly with the information I found on the web and make the links like this:
http://localhost/sitename/page/something

What am I doing wrong? is there something missing from the .htacces ? is the regex wrong? Can anyone help me with the code please?


thanks,
Alex

p.s: another question is: after i get this to work, should I change the links in the php page code to this format? (i told you i am new :P so dont laugh)