Re: [SMARTY] search engine friendly urls php/b/2 not php.php?b=2
| From: | Richard Jones | Date: | Mon, 27 Oct 2003 23:13:54 +0000 |
| Subject: | Re: [SMARTY] search engine friendly urls php/b/2 not php.php?b=2 | ||
| References: | 1 2 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-10445@lists.php.net to get a copy of this message | ||
I suggest you check out apache mod_rewrite
it's a *much* nicer solution than writing crazy php scripts that chop up the
url :)
http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=mod_rewrite&btnG=Google+Search
On Monday 27 October 2003 9:41 pm, Rolf Brusletto wrote:
> Andras Kende wrote:
> >Hello All,
> >
> >I looking for earch engine friendly code for smarty
> >Where urls like php/b/2 not php.php?b=2
> >
> >I have a this php code, cant get to work...
> >
> >
> > if(isset($PATH_INFO)) {
> > $vardata = explode('/', $PATH_INFO);
> > $num_param = count($vardata);
> > if($num_param % 2 == 0) {
> > $vardata[] = '';
> > $num_param++;
> > }
> > for($i = 1; $i < $num_param; $i += 2)
> >{
> > $$vardata[$i] = $vardata[$i+1];
> >}
> >}
> >
> >
> >Thanks,
> >
> >Andras
>
> Also - I've written a tutorial on the way you're looking to rewrite
> urls.. http://www.phpexamples.net/tutorial-6-1.html
>
> its possible that you do not have the right settings in the vhosts file
> for apache(if you even have access to it)... are you sure that you are
> getting $PATH_INFO? Here are the things that need to be added to the
> virtualhost configuration..
>
> <Files php>
> ForceType application/x-httpd-php
> </Files>
> <Directory /path/to/your/html/root/>
> AllowOverride Options FileInfo
> AcceptPathInfo On
> </Directory>
>
> <Files> alows you to force php to parse the set file..
> the other key part is AcceptPathInfo
> if its not set to on, the it will not be passed to php by apache.
>
> Hope it helps,
>
> Rolf Bruslettto
> www.phpExamples.net