Hey. I’m trying to implement a permanent redirect from
This is how my
.conf file looks like.
<VirtualHost *:80 *:443> ServerName www.domain.com ServerAdmin firstname.lastname@example.org DocumentRoot /var/www/domain.com/public_html ErrorLog /var/www/domain.com/logs/error.log CustomLog /var/www/domain.com/logs/access.log combined </VirtualHost> <VirtualHost *:80> ServerName domain.com Redirect permanent / http://www.domain.com </VirtualHost> <VirtualHost *:443> ServerName domain.com Redirect permanent / https://www.domain.com </VirtualHost>
This doesn’t work. It works if I want to achieve the opposite (
domain.com) however - obviously after changing a few things.
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.
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.
Click below to sign up and get $200 of credit to try our products over 60 days!