I need to do properly implement a few redirects and since I am not an .htaccess expert I need some help.
I basically own a domain (domain2) that is set-up as a subdomain of another domain (domain2), which is connected to my shared hosting plan. I installed a SSL certificate for domain2 via cPanel and also installed WordPress to run on domain2.
I need to redirect all http requests to https, redirect the domain2 as a subdomain of domain1 and also make sure it doesn't interfere with the WordPress .htaccess stuff.
Here is what I have tried. The http to https redirect seems to work fine but I am still able to access domain2.domain1.com and it doesn't redirect me to domain2.com.
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond %{HTTP_HOST} ^domain2\.domain1\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.domain2\.domain1\.com$
RewriteRule ^/?$ "http\:\/\/domain2\.com\/" [R=301,L]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Can anyone help?