between 0 and 1

[Apache] Redirect HTTP -> HTTPS and Remove "www" 본문

Software Development Engineering/Dev.Info.

[Apache] Redirect HTTP -> HTTPS and Remove "www"

devxpert.yoon 2021. 1. 3. 18:46
728x90
반응형

httpd-vhosts.conf

 

<VirtualHost *:80>

ServerName localhost

ServerAlias www.localhost

Redirect permanent / https://localhost

</VirtualHost>

 

 

 

<VirtualHost *:443>

DocumentRoot "/Users/devxpert/Dev/webroot"

ServerName localhost

ServerAlias www.localhost

 

Protocols h2 http/1.1

 

<If "%{HTTP_HOST} == 'www.localhost'">

Redirect permanent / https://localhost

</If>

 

SSLEngine on

SSLCertificateFile "/Users/devxpert/Dev/webroot/ssl/localhost.crt"

SSLCertificateKeyFile "/Users/devxpert/Dev/webroot/ssl/localhost.key"

</VirtualHost>

 

 

Remove "www" in url

 

<If "%{HTTP_HOST} == 'www.localhost'">

Redirect permanent / https://localhost

</If>

 

 

 

728x90
반응형