Reply to Re: mod_rewrite and getting url variables

Your name:

Reply:


Posted by Matthew Weier O'Phinney on 04/12/05 18:28

* Ospinto <ospinto@hotmail.com>:
> I used mod_rewrite to change http://www.mysite.com/page/1 to
> http://www.mysite.com/page.php?id=1 to enable a search friendly url.
> Everything works fine, except that when I try to get the URL variable ($id)
> by using $_GET, it doesn't return anything. With
> http://www.mysite.com/page.php?id=1 it gets $id just fine. I thought the
> mod_rewrite would keep the url variables??? If not, I know the alternative
> would be to get the whole url as a string and change it to an array by using
> the "/" as the delimiter and obtain $id from that. But I'd rather go that
> way if there's no other alternative.
> The .htaccess file has the following commands:
>
> RewriteEngine On
> RewriteRule ^page/([0-9]+)/?$ page.php?id=$1 [L]

Try [PT] instead of [L]. [PT] does a Pass-Through -- i.e., passes it on
to the appropriate handler once the rewrite has been performed. Without
this, the page will not be processed as a CGI.

--
Matthew Weier O'Phinney | WEBSITES:
Webmaster and IT Specialist | http://www.garden.org
National Gardening Association | http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org
mailto:matthew@garden.org | http://vermontbotanical.org

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация