Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Server unable to read htaccess file, denying access to be safe

Tags:

.htaccess

I have created a simple app using AngularJS. When I tried to host that project in my website http://demo.gaurabdahal.com/recipefinder it shows the following error:

Forbidden

You don't have permission to access /recipefinder on this server. Server unable to read htaccess file, denying access to be safe

But if I go to http://demo.gaurabdahal.com/ it displays "access denied" message as expected, that I have printed. But why is it unable to open that AngularJS projects "recipefinder". If I tried to put a simple HTML app there, it opens just fine.

The same AngularJS project works fine when I host that in github (http://gaurabdahal.github.io/recipefinder)

I can't understand what's wrong.

like image 907
Saurab Avatar asked Jul 12 '15 08:07

Saurab


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.

What should file permissions be for htaccess?

What permissions should the file have? 644 permissions are usually fine for an . htaccess file. When you create the file on the server, it should already have these permissions set, so there is most likely nothing to change.

What is a .htaccess file?

. htaccess files (or "distributed configuration files") provide a way to make configuration changes on a per-directory basis. A file, containing one or more configuration directives, is placed in a particular document directory, and the directives apply to that directory, and all subdirectories thereof.


2 Answers

I had this problem too. My advice is look in your server error log file. For me, it was that the top directory for the project was not readable. The error log clearly stated this. A simple

sudo chmod 755 <site_top_folder> 

fixed it for me.

like image 105
swedge218 Avatar answered Sep 21 '22 17:09

swedge218


Set group of your public directory to nobody.

like image 37
Mycelin Avatar answered Sep 18 '22 17:09

Mycelin