Forums / Install & configuration / .htaccess is not read by Apache

.htaccess is not read by Apache

Author Message

Pascal France

Monday 27 August 2007 12:25:49 pm

Hi,

During the update from 3.9.2 to 3.9.3 I would like to do a temporary redirection. So, I created a .htaccess with this line inside:

Redirect 302 / http://www.luxpopuli.fr/maintenance.txt?urlend=

(I tried many other syntaxes without more success)

and I created the maintenance.txt file too.

I don't understand why my .htaccess is not read by Apache 1.3.37.
I use a virtualhost which works fine:

NameVirtualHost 88.191.68.68:80
<VirtualHost 88.191.68.68:80>

    DocumentRoot /usr/local/www
    ServerName www.luxpopuli.fr
    DirectoryIndex index.php index.html

    <Directory /usr/local/www>
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <IfModule mod_php4.c>
        php_admin_flag safe_mode Off
        php_admin_value register_globals    0
        php_value magic_quotes_gpc  0
        php_value magic_quotes_runtime  0
        php_value allow_call_time_pass_reference 0
    </IfModule>

    DirectoryIndex index.php
    <IfModule mod_rewrite.c>

        RewriteEngine On
        Rewriterule ^/var/storage/.* - [L]
        Rewriterule ^/var/[^/]+/storage/.* - [L]
        RewriteRule ^/var/cache/texttoimage/.* - [L]
        RewriteRule ^/var/[^/]+/cache/texttoimage/.* - [L]
        Rewriterule ^/design/[^/]+/(stylesheets|images|javascript)/.* - [L]
        Rewriterule ^/share/icons/.* - [L]
        Rewriterule ^/extension/[^/]+/design/[^/]+/(stylesheets|images|javascripts?)/.* - [L]
        Rewriterule ^/packages/styles/.+/(stylesheets|images|javascript)/[^/]+/.* - [L]
        RewriteRule ^/packages/styles/.+/thumbnail/.* - [L]
        RewriteRule ^/favicon.ico - [L]
        RewriteRule ^/robots.txt - [L]

        RewriteRule ^/* /index.php

    </IfModule>

</VirtualHost>

and above this section I can find:

<Directory "/usr/local/www">
    Options Indexes Includes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

AccessFileName .htaccess

phpinfo() gives me:

Loaded Modules

mod_deflate, mod_perl, mod_fastcgi, mod_php4, mod_ssl, mod_setenvif, mod_so, mod_usertrack, mod_headers, mod_auth, mod_access, mod_rewrite, mod_alias, mod_userdir, mod_actions, mod_imap, mod_asis, mod_cgi, mod_dir, mod_autoindex, mod_include, mod_status, mod_negotiation, mod_mime, mod_mime_magic, mod_log_config, mod_env, mod_vhost_alias, http_core

Thanks for your help.

Pascal

Ce qui embellit le désert c'est qu'il cache un puits... quelque part... (A. de Saint-Exupéry) - http://luxpopuli.fr/eZ-Publish

Bruce Morrison

Monday 27 August 2007 4:12:25 pm

Hi Pascal

I suspect that the "AllowOverride None" line is the issue. This line disables .htaccess files.

http://httpd.apache.org/docs/1.3/mod/core.html#allowoverride

Cheers
Bruce

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

Pascal France

Tuesday 28 August 2007 12:13:39 am

Hi Bruce,

You're absolutely right.
I have to convert temporary:

   <Directory /usr/local/www> 
       Options FollowSymLinks 
       AllowOverride None 
   </Directory>

to

   <Directory /usr/local/www> 
       Options All 
       AllowOverride All 
   </Directory>

Once this done, I creat this .htaccess (with VirtualHost):

RewriteEngine on
RewriteCond %{REQUEST_URI} !/maintenance.html$
RewriteCond %{REMOTE_ADDR} !^96\.204\.128\.89
RewriteRule $ /maintenance.html [R=302,L]

...and the maintenance.html file

Without VirtualHost, I can use this .htaccess:

Redirect 302 / http://www.luxpopuli.fr/maintenance.php?urlend=

Regards

Pascal

Ce qui embellit le désert c'est qu'il cache un puits... quelque part... (A. de Saint-Exupéry) - http://luxpopuli.fr/eZ-Publish