Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.htaccess not working on Windows

I've got Apache 2.2 installed on my Windows machine, and there seems to be a problem with .htaccess.

I enabled `mod_rewrite` in `httpd.conf` file, and wrote some conditions into my .htaccess, but nothing works. I tried putting some garbage into it, to see if it would return Internal Server Error, but not even that would work. What could be the problem?

Could the problem be, that my Apache is located in "C:\Program Files\Apache Software Foundation", and my server root is at "C:\Users\Grega\Server"? I can't find anything that would point to .htaccess in httpd.conf

like image 655
Gregor Menih Avatar asked Jul 16 '12 08:07

Gregor Menih


People also ask

Why is my htaccess file not working?

Additionally, double check that the filename is all lowercase. Your .htaccess file should be named exactly as .htaccess. Certain .htaccess rules may be sensitive to where they are located within the .htaccess file and therefore cause an .htaccess not working issue.

What is htaccess and why do I need It?

.htaccess files are extremely useful in many cases for users who either do not have root permissions or for users who simply aren't comfortable in making changes in their web server's configuration file.

How do I disable all htaccess files in Apache?

If the AllowOverride directive is set to None then this will disable all .htaccess files. In order to verify this, you must open the Apache configuration file (typically either called httpd.conf or apache.conf) and check that the AllowOverride directive is set to AllowOverride All.

Why are my htaccess files conflicting with one another?

Since .htaccess file rules apply to the directory that they live in, as well as all other subdirectories, it can happen that two or more .htaccess files are conflicting with one another. To verify this, try disabling each additional .htaccess file you have one-by-one in order to see where the issue is.


1 Answers

Make sure you don't have AllowOverride None set for the directory C:\Users\Grega\Server. Otherwise htaccess files could be entirely ignored. You could turn all the overrides on by an AllowOverride All or at the very least AllowOverride FileInfo.

like image 144
Jon Lin Avatar answered Oct 26 '22 03:10

Jon Lin