.htaccess issue migrating from apache1.3 to apache2.

Posted on 2006-05-28
Last Modified: 2008-02-01
have the following code running in apache 1.3 environment.

index.php is as follows:

require "$DOCUMENT_ROOT/include/init.php";
header("Location: /exec/login.".FILE_EXTENSION);

the folder "exec" has the following .htaccess only

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

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";

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 ?
Question by:collins23
    LVL 10

    Accepted Solution

    You want the rewrite engine :

    RewriteEngine On
    RewriteRule ^(.*) exec.php

    This will only work if mod_rewrite is enabled
    LVL 6

    Author Comment

    where do you live ? coffee ?

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Introduction Many web sites contain image galleries; a common design for these galleries includes a page with a collection of thumbnail images.  You can click on each of the thumbnail images to see the larger version of the image.  This is easily i…
    Both Easy and Powerful How easy is PHP? (  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
    Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
    The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now