Page 1 of 1

ModRewrite

Posted: Fri May 16, 2008 2:36 pm
by GeXus
I have the following modrewrite...

Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.*)/$ ?name=$1 [nc]

I want to a few more parameters, such as:

RewriteRule ^(.*)/(.*)/(.*)/(.*)$ ?name=$1&ab=$2&cd=$3&ef=$4 [nc]

This doesn't seem to be working though. If I only have one parameter populated, then it doesn't work - 404.

Any ideas? There won't always be 4 values, but there will always be the first one.

Re: ModRewrite

Posted: Fri May 16, 2008 2:49 pm
by Kastor
:wink:
RewriteRule ^([^/]*)/([^/]*)/([^/]*)/([^/]*)$ ?name=$1&ab=$2&cd=$3&ef=$4

Re: ModRewrite

Posted: Fri May 16, 2008 6:56 pm
by GeXus
Hmm.. I get the same problem, if I only use the first value (i.e., http://www.domain.com/something/) it returns 404

Re: ModRewrite

Posted: Fri May 16, 2008 10:02 pm
by GeXus
This works...

RewriteRule ^([^/]+)(?:/([^/]+)(?:/([^/]+)(?:/([^/]+))?)?)?/?$ /?name=$1&ab=$2&cd=$3&ef=$4 [QSA,L]