HI guys.
Im using mod_rewrite to do some redirects on a web site.
I want to be able to do the following
mySite.com/ -> Goto Home
mySite.com/foo -> Goto redirect.php and redirect acordingly.
My redirect rule was
RewriteRule (^\w*$) redirect.php?url=$1 [NC]
But im oviously missing something because when I go tomySite.com/ I get sent to redirect.php
I need a regex that allow lower and upper case letters, as well as underscores but it has to ignore “empty” strings so when I go to mySite.com/ the index file is displayed.
Any help?
Thanks!
This might work. By the way, you don’t have to use () in regex to get $1 which returns everything by default.