Linode .htaccess Tutorial Doesn't Affect Any Change
I just set up an Apache server with Linode. They have a tutorial for how to set up a .htaccess file, in this case to restrict traffic from certain IP addresses. Well, I followed the tutorial, and it doesn't do anything. I used the directives "Options -Indexes" and "Deny from all" to see if it would shut down access to the site, and it did nothing.
Here is the tutorial:
https://www.linode.com/docs/web-servers/apache/how-to-set-up-htaccess-on-apache
Does anyone know what additional things I need to do, or if this is tutorial is making implicit assumptions that may not be true in the case of my configuration? How do I get my server to recognize my .htaccess file(s) and apply those restrictions?
1 Reply
I'm sorry to hear that you are having an issue getting your .htaccess file working. I'd be happy to help provide you with some troubleshooting steps to try!
By default, the .htaccess file is not enabled. Just to make sure it's been enabled, you can check it by opening your configuration file using a text editor like nano with sudo nano /etc/apache2/sites-available/yourwebsitehere.com.conf
You'll want to check to see if the below information is added after the VirtualHost block.
</VirtualHost>
<Directory /var/www/html/example.com/public_html>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
If it's not there, you can add it. Then, make sure to save the file. You'll need to restart apache for the changes to take affect. Always restart apache after making changes to the config file if you want them to take immediate effect. Adding the above text will also ensure that AllowOverride
is set to All
.
sudo service apache2 restart
.
You may need to try additional troubleshooting steps if you find that apache still doesn't recognize your .htaccess
file.
Some Common .htaccess Problems
There is no
.
before the file nameLinux file names are case sensitive.
Spelling error: Just one
t
and twos's
These are just a few quick things you can rule out while troubleshooting this issue. Below are a few additional resources that may help with your specific situation.
I hope this has been helpful!