mod_rewrite / .htaccess / regex help

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
alexandruc
Forum Newbie
Posts: 9
Joined: Sat Oct 18, 2008 11:41 am

mod_rewrite / .htaccess / regex help

Post 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)
Post Reply