Jump to content

.htaccess Rewrite Engine


Recommended Posts

So basically, I want to do this:redirect example.com/one to example.com/index.php?one=oneAndredirect example.com/one/two to example.com/index.php?one=one&two=twoI've got the first case working, but not the second one, instead I always get a 404 error.Thanks for any help

Link to comment
Share on other sites

Well, right now as it's in development it's not as general as I want it to be for the second case, so the pertinent stuff looks like this:

RewriteRule ^users/([^.]+)/$ index.php?one=users&two=$1 [NC,L]RewriteRule ^([^.]+)/$ index.php?one=$1 [NC,L]

Honestly it's been too long since I last worked with the rewrite engine to even know if that's supposed to do what I think it is. :)Edit: I got it fixed, it turned out to be precisely because I wasn't doing it in a generic way, but I changed it to

RewriteRule ^([^/]+)/([^.]+)/$ index.php?one=$1&two=$2 [NC,L]RewriteRule ^([^.]+)/$ index.php?one=$1 [NC,L]

And it's all good.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...