Forbidden You don't have permission to access / on this server
Solution 1
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.
Solution 2
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>
Solution 3
Solution is just simple.
If you are trying to access server using your local IP address and you are getting error saying like Forbidden You don't have permission to access / on this server
Just open your httpd.conf file from (in my case C:/wamp/bin/apache/apache2.2.21/conf/httpd.conf
)
Search for
<Directory "D:/wamp/www/">
....
.....
</Directory>
Replace Allow from 127.0.0.1
to
Allow from all
Save changes and restart your server.
Now you can access your server using your IP address
Solution 4
The problem lies in https.conf file!
# Virtual hosts
# Include conf/extra/httpd-vhosts.conf
The error occurs when hash(#) is removed or messed around with. These two lines should appear as shown above.
Solution 5
Found my solution on Apache/2.2.15 (Unix).
And Thanks for answer from @QuantumHive:
First: I finded all
Order allow,deny
Deny from all
instead of
Order allow,deny
Allow from all
and then:
I setted
#
# Control access to UserDir directories. The following is an example
# for a site where these directories are restricted to read-only.
#
#<Directory /var/www/html>
# AllowOverride FileInfo AuthConfig Limit
# Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
# <Limit GET POST OPTIONS>
# Order allow,deny
# Allow from all
# </Limit>
# <LimitExcept GET POST OPTIONS>
# Order deny,allow
# Deny from all
# </LimitExcept>
#</Directory>
Remove the previous "#" annotation to
#
# Control access to UserDir directories. The following is an example
# for a site where these directories are restricted to read-only.
#
<Directory /var/www/html>
AllowOverride FileInfo AuthConfig Limit
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
<Limit GET POST OPTIONS>
Order allow,deny
Allow from all
</Limit>
<LimitExcept GET POST OPTIONS>
Order deny,allow
Deny from all
</LimitExcept>
</Directory>
ps. my WebDir is: /var/www/html
QuantumHive
Updated on November 05, 2020Comments
-
QuantumHive over 3 years
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.
-
robm about 10 yearsholy hell, just migrated from centos and i'm super glad i saw this. Thank you!
-
Andrew Atkinson almost 10 yearsDamn Deprecation! - Apache error message would have been nice
-
sibley over 9 yearsThank you! This save my day!
-
Ant over 9 yearsyes, totally aggree with @AndrewAtkinson. years of apache2, and now, same version, different config.
-
JumpLink about 9 yearsThank you! The default magento 1.9.1 .htaccess used the deprecated way.
-
nyxee over 8 yearsSorry to ask but where exactly should we put that line?
-
haakym almost 8 yearsI'm probably going to leave on work time now thanks to this. Thank you.
-
Jonathan Eustace almost 8 yearsPlease format your answer.
-
Jehan Zeb over 6 yearsThanks! In my case it was /etc/apache2/conf-available/security.conf that was denying the access.
-
aircraft almost 6 yearsmessed around with what?