.htaccess files are ignored and do not work

Created:

2016-11-16 13:14:33 UTC

Modified:

2017-04-26 10:00:06 UTC

3

Was this article helpful?


Have more questions?

Submit a request

.htaccess files are ignored and do not work

Applicable to:

  • Plesk for Linux

Symptoms

The rules defined in .htaccess files are ignored.

Cause

.htaccess files support is not enabled.

Resolution

To enable .htaccess files support, create *.conf file in /etc/httpd/conf.d/ with the following content:

AccessFileName .htaccess

<Directory "/var/www/vhosts">
Options +All
AllowOverride All
Order allow,deny
Allow from all
</Directory>

Then, restart Apache:

# service httpd restart

Please note that in Debian and Ubuntu the service is named "apache2" instead of "httpd" and the path is /etc/apache2/conf.d/ , instead of /etc/httpd/conf.d/ .

Have more questions? Submit a request

6 Comments

  • 0
    Avatar
    Gerasimos Perentidis

    The fix does not work.

    Also the article is vague.

    **** create *.conf file in /etc/httpd/conf.d/ ****

    What is   "  *.conf  "   ???

    What is the correct name for the file ?

  • 0
    Avatar
    Vitaly Zhidkov

    @Gerasimos, you can give any name to this file. For example "enablehtaccess.conf"

  • 0
    Avatar
    Cihan

    I am getting this error when I want to save the file

    [ Error writing /etc/httpd/conf.d/zz010_psa_httpd.conf: No such file or direct ]

  • 0
    Avatar
    Bulat Tsydenov

    @Cihan, you should not touch this file, it is generated by Plesk automatically. In order to regenerate it, you can run `plesk sbin httpdmng --reconfigure-server`

  • 0
    Avatar
    Cihan

    @Bulat I didn't touch it, it doesn't exist. I read in this document (in German) to do it like that: https://kb.plesk.com/de/124

    Also it doesn't matter how I name the file, always getting the error No such file or direct

  • 0
    Avatar
    Bulat Tsydenov

    @Cihan, it seems you don't have `/etc/httpd/conf.d/` folder. Maybe you are using Ubuntu/Debian? In this case, the path should be /etc/apache2/conf.d/

Please sign in to leave a comment.