(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
</Directory>
3. Now, I create an .htaccess file at var/www/html/site:
RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteRule ^(.*)$ %{DOCUMENT_ROOT}/site/index.php [L]
4. So now, a URL that was previously located at http://www.example.com/site/index.php/Bool can now be accessed via http://www.example.com/Bool.
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.
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!
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
</Directory>
…just exactly that:
My changes on .htaccess were not taking. It was a wordpress site I was dealing with.
After reading somewhere, I opened /etc/apache2/apache2.conf and changed line 166 to : AllowOverride All
saved, restarted apache and all worked.
Just to be sure I went and checked just now and it all worked…is working.
Perhaps suddenly your .htaccess file might be working, but have errors?
sure. I use /var/www as my base and created a new directory in www for each website. So /var/www/jellyfsh.com is the root folder for jellyfsh.com 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()); ?>
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.