Re: Apache Rewrite Issues

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

 



Hey Russell,

After Going through all the threads in this post, it is correct to say, GET
Rid of the space. Use "-"  hyphen  for SEO friendly URL's. Its completely
OK.

Other thing which is very handy is urlencode and urldecode functions. When
you are sending a query string use urlencode function. This will preserve
the query string variable as "Test Story" and not as just "Test"; even if
there are spaces in the variable.

Gaurav Kumar
Tech Lead Open Source Solutions

On Wed, Oct 7, 2009 at 4:22 PM, Russell Seymour <
russell.seymour@xxxxxxxxxxxxxxxxxxx> wrote:

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

[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