views:

27

answers:

2

I created a file .htaccess in the /var/www directory. The rights are "root root --wxrwxrwxr".

The content of the file is:

Options +FollowSymlinks
RewriteEngine on
RewriteLogLevel 3
RewriteLog "/var/log/apache2/rewrite.log"
RewriteRule ^(.*?)$ testphp.php

When I call the page phpinfo.php, I've got: Loaded Modules ... mod_rewrite ... Therefore, the modules is loaded.

After each modification, I restared the server manually with sudo /etc/init.d/apache2 restart.

The error.log gives

Apache/2.2.14 (Ubuntu) PHP/5.3.2-1ubuntu4.2 with Suhosin-Patch configured -- resuming normal operations

When I call a page anyone.htm or anyone.php, the rewrite.log does contain nothing and the real page is called. If I understand, the page anyone.php should be replaced by testphp.php

Did I make siomething wrong?

Thanks

A: 

If i were a web server, i'd ignore any config file that was world writable, for stability and security's sakes. I know there's places in Apache that do exactly that; i forget whether .htaccess processing is one of those places, but i'd assume/hope it is.

cHao
Thanks for the answerI changed the files rights to 644 and directory to 755.I restart the Apache server and I've got exactly the same result.
Yvon Blais
If you can afford to do so, add a line of garbage to .htaccess for a minute and make sure it causes a server error. It won't take down the server; it'll just break access to that directory and everything inside. But it's the quickest way i know of (short of rooting through the config files) to make sure your .htaccess file is actually getting used.
cHao
A: 

Thanks for your help

Here is what I made to get the Apache2 server running with the Rewrite Rule

I re-installed the server from a new hard disk

I activated the Rewrite with 'sudo a2enmod rewrite' I created the file '.htaccess' with the rules

RewriteEngine On RewriteRules ^(.*)$ test.php

In the /etc/apache2/sites-available/default, I added in the Directory /

AllowOverride all Order deny,allow Allow from all

and in the Directory /var/www, the same 2 lines

I don't know why, but the rules RewriteLog n does not word in the .htaccess

In the /var/www, I created 2 files, index.html (the default) and test.php The test.php contains

When I call the page index.html, the php info is displayed

One more time, thanks

Yvon Blais