Page 1 of 1

mod_rewrite illegal characters

Posted: Sat Jul 04, 2009 5:25 pm
by paqman
I've set up a CMS system using mod_rewrite, but have run into a small problem. If the user enters, for the 'url name' (http://thesite.com/urlname/) certain invalid characters, the .htaccess file is screwed and the whole website stops working (as expected). I'm going to put in a check to make sure the user cannot enter invalid characters, but which characters are illegal in the .htaccess file? The file looks like this:

Code: Select all

 
RewriteRule ^(products|about|testimonials|services|residential|commercial|Auto and Marine Services|tips)/$ /~kcslocks/pages.php?calling=$1
 
where the names in the brackets are automatically written by a php function every time a page is updated. The 'Auto and Marine' causes the problem. So, does anyone have a list of invalid characters? Does it follow the same rules as a URL? Any help is appreciated.

Re: mod_rewrite illegal characters

Posted: Mon Jul 13, 2009 3:24 pm
by Darhazer
The space should be escaped: "\ "

Code: Select all

RewriteRule ^(products|about|testimonials|services|residential|commercial|Auto\ and\ Marine\ Services|tips)/$ /~kcslocks/pages.php?calling=$1