.htaccess and white space
Posted: Tue Aug 04, 2009 11:54 am
Hi,
I have a simple search input text field where a user can type in a string and get some search results. I'm trying to send the data using a clean URL with the search string in the URL.
ex. searching for 'golf' = http://www.mysite.com/search/golf
This works, however if the user inputs 'golf club' I get a 404 page not found error because of the white space. My .htaccess looks like this so far:
And the code sending the data looks like this:
The results.php page then grabs the $_GET['c'] parameter and queries & displays results. Is there a way I can fix this white space error?
Thanks,
Jason
I have a simple search input text field where a user can type in a string and get some search results. I'm trying to send the data using a clean URL with the search string in the URL.
ex. searching for 'golf' = http://www.mysite.com/search/golf
This works, however if the user inputs 'golf club' I get a 404 page not found error because of the white space. My .htaccess looks like this so far:
Code: Select all
RewriteEngine on
RewriteRule ^search/([a-zA-Z0-9_\-]+%)/?$ results.php?c=$1
Code: Select all
<ul>
<li><p>Search:</p></li>
<li>
<input id="searchLMARK" type="text" name="criteria">
</li>
<li><a href="" onclick="if(document.getElementById('searchLMARK').value!='')location.href='/search/' + escape(document.getElementById('searchLMARK').value);return false;"><span>Search</span></a></li>
</ul>
Thanks,
Jason