Hi,
I'm attempting to create a pseudo-directory based on four querystrings and am struggling to find the right method of mod_rewrite to make it work.
I've tried different flags and even without but cannot get it to work. It's either a 404 or a 500 depending on the flags.
The principle behind it is:
and so on...
.htaccess works fine when there's one rule and all querystrings are passed. Thing is, I've had this working many years ago before but it's been a long time since I've coded and wondered if any of you bright chaps could see where I'm going wrong.
Thanks for your time.
I'm attempting to create a pseudo-directory based on four querystrings and am struggling to find the right method of mod_rewrite to make it work.
Code:
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^(.*)/(.*)/(.*)/(.*)/$ index.php?county=$1&town=$2&business=$3&id=$4 [L]
RewriteRule ^(.*)/(.*)/(.*)/(.*)/$ index.php?county=$1&town=$2&business=$3 [L]
RewriteRule ^(.*)/(.*)/(.*)/(.*)/$ index.php?county=$1&town=$2 [L]
RewriteRule ^(.*)/(.*)/(.*)/(.*)/$ index.php?county=$1 [L]
</IfModule>
The principle behind it is:
Code:
www.example.com/directory/?county=eastsussex
www.example.com/directory/eastsussex/
Code:
www.example.com/directory/?county=eastsussex&town=hastings
www.example.com/directory/eastsussex/hastings/
.htaccess works fine when there's one rule and all querystrings are passed. Thing is, I've had this working many years ago before but it's been a long time since I've coded and wondered if any of you bright chaps could see where I'm going wrong.
Thanks for your time.