Page 1 of 1

Rewrite problem htaccess

Posted: Wed Jul 25, 2012 5:58 am
by nemonline
Hi there,

The following code works just fine on a production server, but when i try it on a test server with same configuration, it fails.
Prod server: PHP Version 5.3.2-1ubuntu4.5
Test server: PHP Version 5.3.2-1ubuntu4.17

Core directives are identical on both servers, since i copied the php.ini file from the Prod. server.

Code: Select all

<?
if (!isset($_GET['id'])){$id = '0';}else{$id = $_GET['id'];} echo"$id <br><br><br>";

if($id=='' or $id=='0'){echo"This is a test page with A SINGLE VAR for htaccess<br><br><a href=\"/test/2.html\">Click for 2 VAR page</a>";}else{echo"$id | This is a test page with 2 VARs for htaccess";}

?>
The Prod server gives me 2.html the message "This is a test page with 2 VARs for htaccess" when i click the link.
The Test server gives me 2.html with the "This is a test page with A SINGLE VAR for htaccess" message when i click the link.

What should i look for? The apache2/error.log is clean.

Here is .htaccess:

Code: Select all

Options +FollowSymLinks
RewriteEngine On

php_flag display_startup_errors on
php_flag display_errors on
php_flag html_errors on
php_value docref_root 0
php_value docref_ext 0

RewriteRule ^(test)/([^/]*)\.html$ /index.php?link=test [L]
RewriteRule ^(test)\.html$ /index.php?link=test [L]

Re: Rewrite problem htaccess

Posted: Wed Jul 25, 2012 9:50 am
by pickle
Mod rewrite and .htaccess don't depend on PHP at all. While the PHP configuration on both servers might be the same, the Apache configuration might not. Take a look at the output from phpinfo() and see if both have mod_rewrite installed.