Forbidden You do not have permission / access on this server

All I wanted to do today was write a redirection rule for the subfolder, for example: You enter the URL: example.com and you are redirected to example.com/subfolder

Such a simple desire. I tried to find a solution on the Internet. The internet told me to add the .htaccess file to the htdocs root directory with:

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

I have done it. But no success obviously, they did not tell me that I had to uncomment the module in httpd.conf :

 LoadModule rewrite_module modules/mod_rewrite.so 

So, I did it too. No success. They did not tell me that I need to modify my httpd.conf so that the .htaccess file is included:

 <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 do not have permission to access this server.

Now I am stuck and I could not find more solutions on the Internet. I just run Apache 2.4 on my Windows 7 machine for private reasons.

+59
apache .htaccess mod-rewrite
Feb 04 '14 at
source share
5 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

 Order allow,deny Allow from all 

The Order and Allow directives are deprecated in Apache 2.4 .

+145
Feb 04 '14 at
source share

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

By default, Appache does not restrict access from ipv4. (shared external ip)

Which may be limited by the configurations in 'httpd.conf' (or 'apache2.conf' depending on your apache configuration)

Decision:

Replace All:

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

from

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

therefore removing all restrictions provided by Apache

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

 <Directory "c:/wamp/www/"> Options Indexes FollowSymLinks AllowOverride all Require all granted # Require local </Directory> 
+11
Jun 25 '16 at 17:43
source share

The solution is simple.

If you try to access the server using the local IP address and you receive an error message, for example, Forbidden You do not have access rights / on this server

Just open the httpd.conf file (in my case C:/wamp/bin/apache/apache2.2.21/conf/httpd.conf )

Search

<Directory "D:/wamp/www/"> .... ..... </Directory>

Replace Allow with 127.0.0.1

to

Allow All

Save the changes and restart the server.

Now you can access your server using your IP address

+3
Jun 10 '16 at 11:31 on
source share

The problem is the https.conf file!

 # Virtual hosts # Include conf/extra/httpd-vhosts.conf 

An error occurs when hash (#) is deleted or obfuscated. These two lines should be displayed as shown above.

+1
Jun 13 '16 at 2:38 on
source share

Found my solution on Apache / 2.2.15 (Unix).

And thanks for the answer from @QuantumHive:

First: I found everything

 Order allow,deny Deny from all 

instead

 Order allow,deny Allow from all 

and then:

I have installed

 # # 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> 

Delete 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: / var / www / html

+1
Jun 01 '17 at 4:15
source share



All Articles