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!
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
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.