.htaccess issue migrating from apache 1.3 to apache2

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
collins23
Forum Newbie
Posts: 1
Joined: Sun May 28, 2006 9:07 am

.htaccess issue migrating from apache 1.3 to apache2

Post by collins23 »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


i have the following code running in apache 1.3 environment.

index.php is as follows:

Code: Select all

<?
require "$DOCUMENT_ROOT/include/init.php";
header("Location: /exec/login.".FILE_EXTENSION);
?>
the folder "exec" has the following .htaccess only

Code: Select all

SetHandler page-php
Action page-php /exec.php
exec.php is as follows

Code: Select all

<?
require "/srv/www/htdocs/intranet/include/init.php";


$folder = ereg_replace("/intranet/exec/|.".FILE_EXTENSION.".*", "", $REQUEST_URI);
$PAGE = new Page($folder);
$USER = new User($session_login, $session_password);
if (!$USER->hasPrivileges($PAGE->privileges)) {
        $err = "You dont have access to this page";
        showErr($err);
}

require $PAGE->parser;

if (!is_file($PAGE->body)) $PAGE->body = "/srv/www/htdocs/intranet/modules/blank.php";

if ($print) require "template/print.php";
else require "template/framework.php";
?>

"FILE_EXTENSION" is a variable i give as extension to all my links ( login.php gets renamed to login.intranet )

this means the URL appears like "http://myserver/intranet/exec/login.intranet" in the browser but actually doesn't exist. but because i have a .htaccess in /exec, it automatically sends all files to exec.php to manipulate.

everything works fine on my old server.

THE PROBLEM is when i transfer my code to apache2 environment. i get error 404 Object Not Found with the above url in the browser. i have enabled .htaccess, allowoveride all in httpd.conf. My apache2 doesn't want to force every file to be manipulated by exec.php, it tries to access the file directly and therefore gives the above error. In the error.log for apache2 i get

"File does not exist: /srv/www/htdocs/intranet/exec/login.intranet"

what should i do ? :(


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Post Reply