Website without www not working however with www its works.

My website is working fine but giving 403 Forbidden error.

I have Apache Ubuntu server. Here is my configuration.

My host file /etc/host

... localhost

My file

DocumentRoot /var/www/

RewriteEngine on
RewriteCond %{SERVER_NAME} = [OR]
RewriteCond %{SERVER_NAME} =
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

I already have configure A record to my IP address XX.XX.XX.32

I also set my CNAME to with TTL 43200

I have installed SSL for HTTPS as well. Having same above

I already check root folder by removing with .htaccess its file. so no problem at htaccess file at all.

I am not sure what else I need to do. I am not able to access my website on or

Any suggestion please.

Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi @ideveloper1990,

So you’ve configured your Hosts file. Let’s assume there are no typos there and see what can be causing the 403 Forbidden Error.

What I can suggest is for you to check your Apache Error Logs. That way you’ll see why exactly it’s giving the Error or if it’s at all reaching the Droplet. The Error log file should be located in /var/log/apache2/error_log or just somewhere in your /var/log/ folder.