Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Forbidden You don't have permission to access / on this server [closed]

All I wanted to do today was to write a redirect rule to a subfolder, e.g.: You enter the URL: example.com and you get redirected to example.com/subfolder

Such a simple wish. I tried to find a solution on the internet. The internet told me to add an .htaccess file in the htdocs root with:

RewriteEngine on RewriteCond %{HTTP_HOST} ^example\.com$ RewriteRule (.*) http://www.example.com/$1 [R=301,L] RewriteRule ^$ subfolder [L] 

I did this. But no success obviously, they didn't told me I had to uncomment the module in httpd.conf:

LoadModule rewrite_module modules/mod_rewrite.so 

So I did this too. No success again. They didn't told me I had to change my httpd.conf so that the .htaccess file would be enabled:

<Directory />     Options FollowSymLinks     AllowOverride None     Order deny,allow     Deny from all </Directory>  DocumentRoot "c:/Apache24/htdocs" <Directory "c:/Apache24/htdocs">     Options Indexes FollowSymLinks     AllowOverride All     Require all granted </Directory> 

Again no success, because I get this error when entering the URL:

Forbidden You don't have permission to access / on this server.

Now I'm stuck and I couldn't find any more solutions on the internet. I'm just running Apache 2.4 on my Windows 7 machine, for private reasons.

like image 630
QuantumHive Avatar asked Feb 04 '14 11:02

QuantumHive


People also ask

What does forbidden you don't have permission to access on this server mean?

The 403 Forbidden error means that your server is working, but you no longer have permission to view all or some of your site for some reason. The two most likely causes of this error are issues with your WordPress site's file permissions or . htaccess file.


2 Answers

Found my solution thanks to Error with .htaccess and mod_rewrite
For Apache 2.4 and in all *.conf files (e.g. httpd-vhosts.conf, http.conf, httpd-autoindex.conf ..etc) use

Require all granted 

instead of

Order allow,deny Allow from all 

The Order and Allow directives are deprecated in Apache 2.4.

like image 168
QuantumHive Avatar answered Oct 17 '22 16:10

QuantumHive


WORKING Method { if there is no problem other than configuration }

By Default Appache is not restricting access from ipv4. (common external ip)

What may restrict is the configurations in 'httpd.conf' (or 'apache2.conf' depending on your apache configuration)

Solution:

Replace all:

<Directory />      AllowOverride none     Require all denied  </Directory> 

with

<Directory />      AllowOverride none #    Require all denied  </Directory> 

hence removing out all restriction given to Apache

Replace Require local with Require all granted at C:/wamp/www/ directory

<Directory "c:/wamp/www/">     Options Indexes FollowSymLinks     AllowOverride all     Require all granted #   Require local </Directory> 
like image 28
jerinisready Avatar answered Oct 17 '22 14:10

jerinisready