Cannot enable the use of .htaccess files - No results

  • Posted on August 17, 2014
  • Sm64ds2Asked by Sm64ds2

(Previous issue solved - A new issue has arisen)

1. I create a .htaccess file at var/www/html:

AuthUserFile /etc/htaccess/.htpasswd
AuthName "Authorization Required"
AuthType Basic
require valid-user

2. I enable the use of .htaccess files at /etc/apache2/sites-available/default-ssl.conf

 <Directory /var/www/html>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all

3. Now, I create an .htaccess file at var/www/html/site:

RewriteEngine On
RewriteRule ^(.*)$ %{DOCUMENT_ROOT}/site/index.php [L]

4. So now, a URL that was previously located at can now be accessed via

5. However, all of this set up produces nothing - .htaccess files do not work.

What’s wrong here? These the setup shown in point 3 worked on my old host.

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

I had a similar issue: could not get my .htacess to work properly, despite having the AllowOverride All in the site.conf file, and restarting apache.

I ended up going into apache2.conf and changing there to AllowOverride All, restarted Apache and it started working.

so in /etc/apache2/apache2.conf:

<Directory /var/www/>
	Options Indexes FollowSymLinks
	AllowOverride All    << changed that to All
	Require all granted


thanks for sharing this, I was breaking my head until found this post!


sure. I use /var/www as my base and created a new directory in www for each website. So /var/www/ is the root folder for My .htaccess file is in the root of the web-folder.

Just a thought: have you made sure your .htaccess is readable by www-data If you created it with your user account, you might want to run: sudo chown -R www-data:www-data /var/www

and then: sudo chmod -R 775 /var/www

I looked, and mod_rewrite is installed, so I must have done that at some point. You can check with:

<?php print_r(apache_get_modules()); ?>