Report this

What is the reason for this report?

How to config for fix

Posted on July 20, 2022

When i enter website in url https://example.com/. i can enter website. but i enter website in url example.com/ Webpage showing error.

 Forbidden
 You don't have permission to access this resource.
 
 Apache/2.4.41 (Ubuntu) Server at example.com Port 80

I check log

sudo tail -100 /var/log/apache2/error.log

This is result

[Wed Jul 20 07:18:22.838769 2022] [rewrite:error] [pid 234347] [client 49.228.236.32:37690] AH00670: Options FollowSymLinks and SymLinksIfOwnerMatch are both off, so the RewriteRule directive is also forbidden due to its similar ability to circumvent directory restrictions : /var/www/example/

I fix in apache2.conf and .htaccess

<VirtualHost *:80>
<Directory /usr/share>
	AllowOverride All
	Require all granted
</Directory>

<Directory /var/www>
        Options +SymLinksIfOwnerMatch
        AllowOverride All
        Order deny,allow
        Allow from all
</Directory>

#<Directory /srv>
#	Options Indexes FollowSymLinks
#	AllowOverride All
#	Require all granted
#</Directory>
</VirtualHost>

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

Bug can not fix issue



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hello,

As your HTTPS version is working as expected, what I could suggest is to add a redirect from HTTP to HTTPS so that the users would be redirected to the correct version rather than seeing the 403 error.

You can do that by adding the following to your Apache virtual host for port 80:

RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L,QSA]

Hope that this helps!

Best,

Bobby

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

Dark mode is coming soon.