Reputation: 673
I am using Apache in server side.I want to redirect all HTTP requests which are coming to server into HTTPS.
My question: How i can configure httpd.conf for This? For Example:Suppose user entered http://doc.com/ i want redirect it to https://doc.com/
Upvotes: 0
Views: 125
Reputation: 5317
This requires mod_rewrite
but is able to keep query strings:
RewriteEngine On
RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
This doesn’t and is lighter on the server:
RedirectMatch permanent ^(.*)$ https://doc.com/$1
If you just want to redirect all nōn-HTTPS requests to the start page, use:
RedirectMatch permanent . https://doc.com/
Upvotes: 2
Reputation: 673
RewriteEngine On
RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R=301,L]
Upvotes: 0