Re: Apache Rewrite Issues

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



----- Original Message ----
> From: Russell Seymour <russell.seymour@xxxxxxxxxxxxxxxxxxx>
> To: php-general@xxxxxxxxxxxxx
> Sent: Wed, October 7, 2009 3:52:00 AM
> Subject:  Apache Rewrite Issues
> 
> 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 Story
> 
> to be proxied to
> 
>     mysite.example.com/index.php?m=articles&t=Test%20Story
> 

Russell,

Consider using a string function to replace the space with _ to be really SEF/SEO when generating the URL.  Thus, your problem also disappears ;)

Regards,
Tommy

> I 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


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux