[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 254
  • Last Modified:

.htaccess issue migrating from apache1.3 to apache2.

have the following code running in apache 1.3 environment.

index.php is as follows:

#############
[code]<?
require "$DOCUMENT_ROOT/include/init.php";
header("Location: /exec/login.".FILE_EXTENSION);
?>[/code

the folder "exec" has the following .htaccess only

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


[code]<?
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";
?>[/code]


"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 ?
0
collins23
Asked:
collins23
1 Solution
 
ClickCentricCommented:
You want the rewrite engine :

RewriteEngine On
RewriteRule ^(.*) exec.php

This will only work if mod_rewrite is enabled

http://httpd.apache.org/docs/2.0/misc/rewriteguide.html
0
 
collins23Author Commented:
where do you live ? coffee ?
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now