Sunday, May 20, 2018

apache - 301 redirect in apace.conf, non-www to www AND http:// to https://

I am trying to send all traffic to https://www.example.com without using RewriteEngine, because it is a heavy solution.



I realize there are solutions out there for my problem involving .htaccess file but I am trying to do this in apache.conf in /apache2/sites-enabled




Behavior now:





UPDATE: It seems to me that Virtualhost *:443 doesn't change anything in the below conf file, I have played around with 433 sections but they don't effect the behavior on server at all.



Here is my apache.conf:





ServerName example.com
ServerAlias www.example.com
.
.
.
Redirect 301 / https://www.example.com/


#added this part to fix the issue but it didn't help
ServerName example.com

Redirect 301 / https://www.example.com/
.
.



ServerName www.example.com
.
.




Also, it would be great to know if there is any risks/inefficiency related to this approach.



I appreciate all your comments!

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...