Page 1 of 1

[SOLVED] Webserver, redirect/force https (apache)

PostPosted: Jun 1st, '22, 15:32
by xboxboy
I've scoured the web, but the virtual host file my install has, uses _default_:80 where as most guides use *:80, and despite trying various things I can not get it to work.

I can access my site(s) by http, and manually by https : but I'd like to block/redirect all traffic to https.

And I'd prefer to do it via /etc/httpd/conf/sites.d/vhosts than messing with .htaccess.

My 00_default_vhosts.conf is

Code: Select all
<VirtualHost _default_:80>
    ServerAdmin root@localhost
    ServerName localhost
</VirtualHost>


Appreciate any help.

Re: Webserver, redirect/force https (apache)

PostPosted: Jun 3rd, '22, 10:29
by xboxboy
I've got it working: This is what I've come up with

Code: Select all
cat 00_default_vhosts.conf
# default virtual host, used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.

#<VirtualHost _default_:80>
#    ServerAdmin root@localhost
#    ServerName localhost
#    Redirect permanent / https://localhost/
#</VirtualHost>

<VirtualHost *:80>
    ServerName localhost
    Redirect permanent / https://10.0.0.98/
</VirtualHost>