Re: php as php3 perhaps with htaccess
| From: | Ernest E Vogelsinger | Date: | Mon, 03 Mar 2003 10:25:00 +0000 |
| Subject: | Re: php as php3 perhaps with htaccess | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-137866@lists.php.net to get a copy of this message | ||
At 10:21 03.03.2003, Cranky said:
--------------------[snip]--------------------
>I have a website and all my files are *.php3
>I would like to change the extensions of all files to *.php
>
>So I would like to know if there is a way perhaps with a .htaccess file to
>say that the file .php3 must be redirect to the same file but in *.php
>
>So when I try to access this page :
>http://www.my-site.com/page.php3?param=value
>
>I will access this page :
>http://www.my-site.com/page.php?param=value
--------------------[snip]--------------------
If you have the ability to use mod-rewrite, you can do
RewriteEngine On
RewriteCond %{REQUEST_URI} ^.*\.php3.*$ [NC]
RewriteRule ^(.*)\.php3(.*)$ $1.php$2 [L]
This can be done either in the general configuration, within <VirtualHost>,
or within <Directory>.
I am using exactly this stuff to allow legacy links to a site that has been
developed in Python (*.py) to access the same URLs as PHP files.
--
>O Ernest E. Vogelsinger
(\) ICQ #13394035
^ http://www.vogelsinger.at/