Helen Neely
Helen Neely

Reputation: 4740

HTACCESS Rewrite Error - Not working

I have this regex in my .htaccess but it's not working. What I'm trying to achieve is for this link: http://www.domain.com/ to receive 4 optional parameters, so it looks like this. http://www.domain.com/var1/var2/var3/var4.

But for some reason, this code does not work, I keep getting a 404 error.

RewriteRule ^([^/]+)/([^\.]+)/([^/]+)/([^\.]+)/$ index.php?var1=$1&var2=$2&var3=$3&var4=$4

Any help is appreciated.

Thanks Helen.

Update:

If what I have above is not correct, could someone show me how I can supply 4 parameters to my url so http://www.domain.com/index.php?var1=$1&var2=$2&var3=$3&var4=$4 looks like this: http://www.domain.com/var1/var2/var3/var4

Thanks

Upvotes: 1

Views: 69

Answers (1)

arkascha
arkascha

Reputation: 42885

Well there are three things we can say:

  1. in the example you give in the intro there are no query arguments added, but tokens in a path. Yet in the RewriteRule you add query parameters. That does not match.

  2. the 404 return code you get indicates that the file index.php does not exist (at least not where the server looks for it.

  3. the regex you use inside the RewriteRule certainly won't match anything.

You should start by logging what is actually going on inside thr rewriting process. You won't udnerstand it otherwise. Check the two options RewriteLog and RewriteLogLevel that mod_rewrite provides and their excellent documentation.

Upvotes: 1

Related Questions