htaccess rewrite query

Associate
Joined
18 May 2006
Posts
785
I've posted the query on stackoverflow if you'd prefer to reply there:

http://stackoverflow.com/questions/11559333/htaccess-mod-rewrite-with-no-suffix

or


I'm trying to get the following Mod Rewrite to work with no trailing slash as a suffix or file name.

RewriteEngine On
RewriteRule ^test/([^/]*)/([^/]*)/$ /example1/example2/index.php?brand=

$1&video=$2 [L]
The above works however if I remove the trailing slash from /$ it wont work.

So just to recap:

www.example.co.uk/example/example2/index.php?brand=x&video=y

rewrites to

www.example.co.uk/test/brand/video/

but I can't get it working for

www.example.co.uk/test/brand/video
 
You should keep trailing slashes IMO.

When you remove the trailing slash, are you keeping the $ - as this is important as it denotes the end of the URL string.
 
Hi mate, I am keeping the $ yep just removing the slash - it doesn't seem to like no suffix at the end tho. Can I ask why you think the trailing slash is worth keeping?
 
Personally I prefer the aesthetics of a Url with a slash at the end. If it has no slash it looks to me like you're looking at a page with no extension.
 
Back
Top Bottom