renamed - [OT] alternative to mod rewrite (was Smarty and speed)
| From: | Rod K | Date: | Sun, 09 Dec 2001 12:52:32 +0000 |
| Subject: | renamed - [OT] alternative to mod rewrite (was Smarty and speed) | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-2220@lists.php.net to get a copy of this message | ||
For something this simple you can do this in httpd.conf:
<Location /index>
ForceType application/x-httpd-php
</Location>
Rename index.php 'index'
Add these lines to 'index':
$params=explode("/",$REQUEST_URI);
$articleID=$params[2];
// note $REQUEST_URI will be '/index/...' so
// $params[0] == ''
// $params[1] == 'index'
Now you can call the article like:
www.example.com/index/2
www.example.com/index/5
www.example.com/index/567
The nice thing is you can add any number of parameters to the url and
they'll be available in the $url_array;
> -----Original Message-----
> From: Brian E. Lozier [mailto:brian@massassi.net]
> Sent: Sunday, December 09, 2001 12:17 AM
> To: smarty@lists.ispi.net
> Subject: [smarty] Re:Re:Re: Smarty and speed
>
>
> Will you please post the rewrite junk that you use for it? The
> code in the previous results in an internal
> server errror, and I'm not all that great with regular expressions.
>
> Honestly, I just need one I can throw into a .htaccess that will
> replace things like:
>
> 2.php
> 5.php
> 567.php
>
> With these:
> index.php?articleID=2
> index.php?articleID=5
> index.php?articleID=567
>
> Thanks in advance!
>
> Brian
>
>
>