0

I build my site with Joomla and host with Linode.

I was trying to understand .htaccess file. I learned some directives and added them on my htaccess.txt file but things weren't going as I expected. To test whether I put the contents on right file, I rename the htaccess.txt file to .bak. But I am surprised to see that after this change, my site is still running.

I did remember the other day, I tried changing htaccess.txt to .htaccess and my site is getting 500 error. I didn't do anything after that but today my site can run without it. I then move the .htaccess file (which was manually created by me) to another folder, and my site is still working. Could it be cache? I changed to another browser and my mobile, the site is still working! Mystery to me!

Also, on my linux server, /etc/apache2/apache2.conf, there are these lines:

# AccessFileName: The name of the file to look for in each directory
# for additional configuration directives.  See also the AllowOverride
# directive.
#
AccessFileName .htaccess

I think this means every folders of every sites on my server use .htaccess. However, on this linux server I have several different Joomla sites, and some of them are using htaccess.txt and the others .htaccess!! Another mystery to me! Why is this?

2

Firstly if the file is named htaccess.txt then that means the htaccess file is not enabled as only the file named .htaccess will work.

Secondly if you are getting a 500 error when you enable the .htaccess file you either have an error in your htaccess syntax or overrides are not supported. You would need to check the error logs to see which one it is. Some hosting providers, especially on shared servers, disable htaccess files as using htaccess overrides the server configurations applied by the hosting provider and can be dangerous if not done correctly.

From my research linode supports .htaccess overrides so the only thing I can suggest is that you check your htaccess syntax. If you are using the Joomla htaccess file check if the URL rewrite rules have been enabled as I have found the number one cause of htaccess errors where Joomla is involved is a server that does not have mod_rewrite enabled on the Apache server and yet is trying to declare rewrite rules in a htaccess directive.

2

A site doesn't have to have a .htaccess file. If you don't have a .htaccess file, your site will run on the settings in the apache and PHP server configuration files.

Having your file named .htacces.txt (or .htaccess.bak for that matter) will not have any effect on your server, it won't refer to the file for any settings.

If you then rename your file to .htaccess the server will refer to the file. Since it then breaks, the error 500 tells you that there is some sort of error in the .htaccess file.

If it were me, I would copy everything to a text file, delete it from .htaccess and then add it line by line or block by block and see which line cause the error.

Assuming it isn't too big, you could post the contents of your .htaccess as an edit on the original question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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