September 24th, 2008, 09:51 AM
REGEX help on url redirection with mod_rewrite
im using an .htaccess file on my server to do url redirection. basically im hiding php server variables from the user w/ a mod_rewite trick. the code i have "works" but not quite the way i want it...
so, if you enter this url:
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)$ info.php?x=$1&y=$2&z=$3
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/$ info.php?x=$1&y=$2&z=$3
that will display the content from
which is want i want it to do.
but, i want those 3 variables to be OPTIONAL!
so, if your typed in just /xero/owns it would do mysite.com/info.php?x=xero&y=owns&z= (null)
can any one point me in the right direction?
i should have posted this in the apache forum.
also, i found the answer on this sticky
Last edited by ph33r; September 24th, 2008 at 10:04 AM.
| http://xero.nu |