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

This forum is dedicated to advanced help and support :

Ask here your questions about advanced usage of Mageia. For example you may post here all your questions about network and automated installs, complex server configurations, kernel tuning, creating your own Mageia mirrors, and all tasks likely to be touchy even for skilled users.

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

Postby xboxboy » Jun 1st, '22, 15:32

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.
Last edited by xboxboy on Jun 3rd, '22, 10:30, edited 1 time in total.
xboxboy
 
Posts: 401
Joined: Jun 2nd, '13, 06:41

Re: Webserver, redirect/force https (apache)

Postby xboxboy » Jun 3rd, '22, 10:29

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>
xboxboy
 
Posts: 401
Joined: Jun 2nd, '13, 06:41


Return to Advanced support

Who is online

Users browsing this forum: No registered users and 1 guest

cron