(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!
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.
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:
Hi,
thanks for sharing this, I was breaking my head until found this post!
Regards…
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: