View Single Post
Old 09-16-2005, 03:03 PM  
J.P.
Confirmed User
 
Join Date: Jun 2004
Posts: 689
psili, that code won't work, because .* matches everything 0 or more times and /? matches a character 0 times or once... so this code of yours would match
http://www.domain.com/category/postname.html also

Code:
RewriteEngine on
RewriteRule $categories/([^/\.]+)/?^ categories/$1.html [R=301]
this would match everything except for / and . 1 or more times, so http://www.domain.com/category/postname.html would not match...

This is not tested also, so maybe there are errors in this too

Note that the above code will work in .htacces only, to use it in httpd.conf you should add / right before the categories, like this:

Code:
RewriteEngine on
RewriteRule $/categories/([^/\.]+)/?^ /categories/$1.html [R=301]
Julio
__________________
Webmasters! Looking for new affiliate programs to promote?
Affiliate Program Search <-- Search for programs with FHGs, RSS feed, specific niche sponsors, ...
J.P. is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote