I had some issues with my apache configuration and I’m trying to isolate the problem.
I came up with the following lines which are not working :
For testing purposes, I’m trying to redirect all https traffic to Yahoo
The redirection is not working and my web site is showing the index.html file stored in public_html
Listen 443
NameVirtualHost *:443
<VirtualHost *:443>
DocumentRoot "${SRVROOT}/htdocs/example.com/public_html"
ServerName example.com
ServerAlias example
Redirect permanent / https://www.yahoo.com/
</VirtualHost>
Can anyone help please ?
Thanks
2
Answers
Use this for the redirect, also enable mod_rewrite for this to work:
Add this to the top of your .htaccess file:
Clear your browser’s cache to have a different redirect than yahoo.com, once it works.
Just in case
If you want all traffic of your website to redirect to https:// on the same domain, do the following, don’t remove
RewriteEngine On
andRewriteBase /
:If you want to redirect all traffic to one domain with https:
If you want to redirect all traffic to one domain with https and www: