Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Centos htaccess not being read

Tags:

.htaccess

lamp

I'm working on a new server and I installed via yum the "Web Server" group. Php and mysql work fine but I can't get .htaccess to work.

Heres my test .htaccess file:

WASD_TEST_CALL_ERROR

I put this as .htaccess in a test folder along with an index.html page. Instead of reporting an error it goes ahead and loads the index page without displaying any errors.

Thanks

like image 670
Kamran224 Avatar asked Dec 18 '11 12:12

Kamran224


People also ask

Why is my .htaccess file not working?

Improper syntax being used It is quite common for a syntax error to be the reason for an . htaccess file not working. If you are familiar with how to read and configure . htaccess rules, double check your configuration.

How can I tell if htaccess is working?

In your browser, open /test , with the correct domain name. So, it should look like http://localhost/test or http://example.org/test . If you see the following, it works!

Where is .htaccess file located in Centos?

htaccess files located under the /var/www/html directory.


1 Answers

Make sure AccessFileName set to .htaccess

Search httpd.conf for AccessFileName directive. It defines name of the distributed configuration file:

grep -i AccessFileName httpd.conf

Make sure users are allowed to use .htaccess file

What you can put in these files is determined by the AllowOverride directive. This directive specifies, in categories, what directives will be honored if they are found in a .htaccess file. If this directive is set to None, then .htaccess files are completely ignored. In this case, the server will not even attempt to read .htaccess files in the filesystem.

grep -i AllowOverride httpd.conf

When this directive is set to All, then any directive which has the .htaccess Context is allowed in .htaccess files: AllowOverride All

Save and close the file. Restart httpd:

service httpd restart
like image 87
Unknown3r Avatar answered Oct 24 '22 08:10

Unknown3r