White Space in HTACCESS Query

Avatar
  • Answered
I do host several sites with inmotion. I've recently changed my htaccess file to reflect sef urls (search engine friendly). I've noticed that my queries are now being cut off at the whitespace, for instance if someone searches for "good cars", only the word "good" is used in the query. My htaccess code looks like the following.
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^search/(.*)\.php search.php?pro_query=$1
RewriteRule ^search/(.*)\.php$ /scripts/search.php?pro_query=$1
RewriteCond %{QUERY_STRING} ^pro_query=([0-9,a-z]+)
RewriteRule ^scripts/search\.php /search/%1.php? [R=301,L]

I'm at a lost, I've been researching this and have tried dozens of different changes.

Thanks,

Matt P.
Avatar
Scott
Hello Matt P. The 'rule' is to not have spaces in your URL. These are usually converted to either + or _ for seo friendly URLs. But, for your specific question, you need to have whitespace added to your range. Instead of your current:
([0-9,a-z]+)
You will want something like:
([a-zA-Z0-9_\-\s]+%)
It may need some tweaking, but that is the concept. Kindest Regards, Scott M