Re: Not quite PHP, but related...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux