2

I'm having a problem with an .htaccess file on a newly installed Ubuntu server running Apache2.

The .htaccess file in the directory where the WordPress files are located isn't being take into account when the server loads pages. There isn't an AllowOverride statement in the apache2.conf file, but the default is All, and it doesn't change anything if I include one.

I've tried including the contents of the local .htaccess file in a section. I've also tried this:

<Directory /var/www/mydomain.com/html>
AllowOverride All
</Directory>

I also tried changing all instances of AllowOverride in /etc/apache2/sites-available/default (which are all set to Noneby default) to All.

But I've had no luck.

Not sure how to solve this one.

1 Answer 1

3

Are the Apache configuration files you are reviewing the same files being used by Apache?

Run apache2ctl -V and confirm that the SERVER_CONFIG_FILE entry matches your expectations and references the VirtualHosts declarations you are looking at. (Not a typical problem with a fresh install but a possibility if you've inherited someone else's configuration)

Is there an AccessFileName directive which specifies anything other than .htaccess?

If so, try renaming your .htaccess files accordingly or commenting out the directive (if you can confirm that no existing override files rely upon it).

Is there an AllowOverride directive limiting which directives are allowed?

It sounds as though you have already looked for and resolved issues with this directive, however, you will also need to restart Apache to apply any changes to the AccessFilename or AllowOverride directives.

Are the directives in your override file supported by installed modules?

This can be particularly easy to miss if your override directives are wrapped in IfModule conditionals.

The easiest way to test is to add a core directive before any other override directives to the override file - for example, at the beginning of your .htaccess file add:

Order allow,deny
deny from all

If your override file is parsed by Apache this should cause Apache to deny all requests against the directory - if your testing confirms that the override file is being parsed but the other directives are being ignored, check the installed modules and enable any modules you will need - e.g. a2enmod rewrite (which is probably the module your WordPress installation is attempting to use, not enabled by default with some recent releases on Ubuntu)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.