LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Redirect Main domain and subdomain from http to https (https://www.linuxquestions.org/questions/linux-newbie-8/redirect-main-domain-and-subdomain-from-http-to-https-4175605511/)

Navdeep.D2 05-08-2017 01:11 PM

Redirect Main domain and subdomain from http to https
 
1 Attachment(s)
hello,
i want to redirect these sub domains and main domain from http to https and sub blogs too.
Home directories
WWW (Wordpress): /home1/placehq5/public_html/.htaccess
My Somadome (PHP): /home1/placehq5/public_html/my
Kiosk site (HTML): /home1/placehq5/public_html/kiosk
Config
Webserver is Apache version 2.2.31 (on Linux)

please correct this htaccess file.
Code:

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://somadome.com/$1 [L,R=301]

RewriteCond %{SERVER_PORT} 443
RewriteCond %{HTTP_HOST} ^www[.].+$
RewriteRule ^(.*)$ https://somadome.com/$1 [L,R=301]

in this picture first column is how my urls are right now, 2nd column is what i want after htaccess rules, 3rd coulmn is what iam getting after applying these rule below:-

Attachment 24965
Please Help

bathory 05-09-2017 04:33 AM

Hi,

I would try:
Code:

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [L,R=301]

RewriteCond %{HTTP_HOST} ^www.somadome.com$
RewriteRule ^(.*)$ http://somadome.com/$1 [R=301,L]



All times are GMT -5. The time now is 12:19 PM.