Apache Rewrite Issues
| From: | Russell Seymour | Date: | Wed, 07 Oct 2009 10:52:00 +0000 |
| Subject: | Apache Rewrite Issues | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-298745@lists.php.net to get a copy of this message | ||
Morning,
I am trying to make my URLs more search engine friendly and I have come up against a problem.
I want the following URL:
mysite.example.com/articles/Test Storyto be proxied to
mysite.example.com/index.php?m=articles&t=Test%20StoryI have the following rule in my Apache conf
RewriteRule ^/articles/(.*) index.php?m=articles&t=$1 [P,L]Now if I run with this configuration, PHP strips the query string back at the space, so my query string ends up looking like [QUERY_STRING] => m=articles&t=Test even though the log file for the rewrite shows that the full query is being passed. But if I change the RewriteRule to be a Rewrite instead of a Proxy I get [QUERY_STRING] => m=articles&t=Test%20Story So something is happening when the system is proxying the request. Adding %20 into the URL does not fix the problem when proxy is enabled either. I have search around on the Internet, and people talk about using urlencode etc, this is fine when PHP is creating the URL but not when Apache is doing the rewrite. I apologise if people feel this is on the wrong list, but as far as I can tell from the rewrite logs the data is coming all the way through to PHP which is truncating it. This is purely my observation. Apache version: 2.2.11 PHP Version: 5.3.0 Any help is gratefully recieved. Thanks, Russell