Re: [PHP] Apache Rewrite Issues
On Wed, 2009-10-07 at 16:49 -0400, Paul M Foster wrote: > On Wed, Oct 07, 2009 at 11:52:00AM +0100, Russell Seymour 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 > > > > Aside from the solution to your problem (which I don't have), you might > want to double-check on the "search engine friendliness" of URLs which > contain query strings. I know at one time this was the case, but the > latest I've heard is that URLs like your second one above are completely > okay with search engines. If someone else knows different, please speak > up. > > And oh by the way, don't *ever* store a filename with a space in it on > your computer. It's Evil(tm). I curse the idiot who first came up with > allowing this in filenames. I have a special voodoo doll just for that > person, when I find them. As you can see, it causes all manner of odd > problems, no matter what OS it's on. (My local LUG list is periodically > hit with messages from people trying to overcome the problems attendant > to this habit.) > > Paul > > -- > Paul M. Foster > I do a lot of research into SEO, and the only evidence I've found that comes close to this is where a website set up a page containing a fictional keyword in the URL, then searched for that word a week or two later. I don't know how valid the 'SEO friendly URLs' are though. How often have you searched for the answer to a question online and had the top few results turn out to be forums with dynamic query-string URLs?! Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] Apache Rewrite Issues
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.seym...@turtlesystems.co.uk> 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 > > >
Re: [PHP] Apache Rewrite Issues
On Wed, Oct 07, 2009 at 11:52:00AM +0100, Russell Seymour 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 > Aside from the solution to your problem (which I don't have), you might want to double-check on the "search engine friendliness" of URLs which contain query strings. I know at one time this was the case, but the latest I've heard is that URLs like your second one above are completely okay with search engines. If someone else knows different, please speak up. And oh by the way, don't *ever* store a filename with a space in it on your computer. It's Evil(tm). I curse the idiot who first came up with allowing this in filenames. I have a special voodoo doll just for that person, when I find them. As you can see, it causes all manner of odd problems, no matter what OS it's on. (My local LUG list is periodically hit with messages from people trying to overcome the problems attendant to this habit.) Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Apache Rewrite Issues
- Original Message > From: Russell Seymour > To: php-general@lists.php.net > Sent: Wed, October 7, 2009 3:52:00 AM > Subject: [PHP] 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
[PHP] 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 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