.htaccess not working

Discussion in 'Apache' started by Mostapha777, Jul 24, 2013.

  1. #1
    I have set some settings in my .htaccess file. But it does not work and it seems that apache ignore it.
    i also checked the etc/apache2/httpd.conf. The file was empty and i added following lines to it:

    <Directory />
    AllowOverride All
    </Directory>
    But still it's not working and noting happens when i change .htaccess file.
    I really don't know what to do. Any suggestion plz?
     
    Mostapha777, Jul 24, 2013 IP
  2. RoseHosting

    RoseHosting Well-Known Member

    Messages:
    230
    Likes Received:
    11
    Best Answers:
    11
    Trophy Points:
    138
    #2
    what gnu/linux distribution is this?

    I assume it is debian, so mod_rewrite stuff are placed within the default vhost block in
    /etc/apache2/sites-enabled/000-default
    Code (markup):
    if this file is not present, run
    # a2ensite default
    Code (markup):
    to enable it.

    then check '/etc/apache2/sites-enabled/000-default' and you will see that there is the following:
    <Directory /var/www/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride None
            Order allow,deny
            allow from all
    </Directory>
    Code (markup):
    simply change 'AllowOverride None' to 'AllowOverride All' and it will enable rewrites.

    additionally, you may want to check if mod_rewrite is actually enabled on your server. you can simply do this in debian:
    # test ! -L /etc/apache2/mods-enabled/rewrite.load && a2enmod rewrite
    Code (markup):
    don't forget to restart your apache so the changes you make can take effect.

    hope this helps
     
    RoseHosting, Jul 24, 2013 IP
    Arick unirow likes this.