Re: Not quite PHP, but related...
| From: | Tom Rogers | Date: | Sat, 11 Dec 2004 02:41:32 +0000 |
| Subject: | Re: Not quite PHP, but related... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-204026@lists.php.net to get a copy of this message | ||
Hi,
Saturday, December 11, 2004, 8:16:44 AM, you wrote:
BBBM> Hi you all,
BBBM> is that possible using .htaccess to redirect every request to a
BBBM> specified script?
BBBM> for example if you have:
BBBM> http://www.yoursite.com/en/articles/blab.html
BBBM> where there isn't a en dir., so it would be redirected to
BBBM> public_html/site
BBBM> I could use error page, but it won't receive post, get, cookie and
BBBM> session headers.
BBBM> Regards,
BBBM> Bruno B B Magalhaes
You can force apache to treat en as a php file with
<FilesMatch "^en$">
ForceType application/x-httpd-php
</FilesMatch>
in the .htacess of the root directory (although I put it in the main httpd.conf
as I have access to it)
Then as an example, in the file en (note no .php)
<?php
$file = $_SERVER['DOCUMENT_ROOT'].'/lang/en/'.$_SERVER['PATH_INFO'];
if(is_file($file)) include($file);
else echo "Error: $file does not exist<br>";
?>
replace $file with whatever file is needed.
--
regards,
Tom