Rewrite problem htaccess

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
nemonline
Forum Newbie
Posts: 2
Joined: Fri Mar 23, 2012 6:18 am

Rewrite problem htaccess

Post 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]
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: Rewrite problem htaccess

Post 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.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply