Currently I redirect all http users (www or non-www) of upscfever.com to http://upscfever.com/upsc-fever/index.html
using
RewriteEngine on
RewriteCond %{HTTP_HOST} ^upscfever.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.upscfever.com$
RewriteRule ^/?$ "http://upscfever.com/upsc-fever/index.html" [R=301,L]
Now I want all users to shift to https so I modified as follows:
RewriteEngine on
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^upscfever.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.upscfever.com$
RewriteRule ^/?$ "https://upscfever.com/upsc-fever/index.html" [R=301,L]
So that all who type upscfever.com OR www.upscfever.com should go to
https://upscfever.com/upsc-fever/index.html – instead
Plus all links should be https. But its not working I get Page not found.
5
Answers
Your server has to setup the https first, depend on hosting vendor, if your hosting is vps you need to setup https for apache, install cert also.
You can find some instruction like this:
https://manual.seafile.com/deploy/https_with_apache.html
https://www.digicert.com/csr-ssl-installation/apache-openssl.htm
I think you want to make 3 different changes:
There is no
R=301
part here because I’m not sure it is really wise to make permanent such a redirect to an obscure inner URL.Making this redirect permanent seems pretty safe.
//
prefix or explicitlyhttps://
instead of currenthttp://
. Preserve the protocol for the external links as is.As for troubleshooting, you may use the Network tab of the Chrome DevTools (F12) to see exact server reply (note: enabling “Preserve log” and “Disable cache” flags is useful in such context)
You can do that using a single rule as follows in your site root .htaccess:
This will redirect both
http
andhttps
URLs.You may try something like this:
I hope below code will do the work for you
just simply add above code in .htaccess below
authorization header condition
is written underRewriteEngine On
Let me know if that helps.