Re: URL Rewriting
| From: | Silvio Siefke | Date: | Wed, 22 Jun 2011 22:03:26 +0000 |
| Subject: | Re: URL Rewriting | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-313658@lists.php.net to get a copy of this message | ||
On Wed, 22 Jun 2011 17:50:49 -0400 Daniel P. Brown wrote:
> > Has someone a Link with Tutorials or other Information?
>
> Not entirely sure what you're asking here, or how you (or the
> nginx folks) expect it to relate to PHP. Do you mean that you want to
> use PHP to have theme2.php act as if it was called as theme.php?id=2 ?
I have me write a blog, but my blog has link like blogdetail.html?id=1 or =2
through 16 at moment. And for google and other Search Engines not good the
links, better where i can rewrite to a fix link, and when someone use the
link, php write to correct url.
Sorry my english not perfect on earth.
> If so, it's not redirect or rewrite, and it's extremely hacky, but
> this is the only real way PHP could achieve the desired result:
>
> <?php
> // dynamictheme.php
>
> if (preg_match('/.*([0-9]+)\.php/Ui',$_SERVER['PHP_SELF'],$match)) {
> $_GET['id'] = $match[1];
> include dirname(__FILE__).'/theme.php';
> }
>
> ?>
>
> Then just symlink dynamictheme.php to your various themes like so:
>
> ln -s dynamictheme.php theme2.php
> ln -s dynamictheme.php theme301.php
> ln -s dynamictheme.php theme18447.php
>
Regards
Silvio