Skip to main content
cPanel Technical Support has been heavily impacted by hurricane Beryl and our ability to respond to tickets has been hindered as a result. We appreciate your understanding and patience as we address these delays.

https to https URL redirection

Comments

5 comments

  • cPanelMichael
    Hello :) You will often see more feedback on custom Mod_Rewrite rules for redirection on websites such as StackOverflow. Here's one example I found: Htaccess url redirect only https urls Thank you.
    0
  • triaxial
    Tried that it does not work.. The word press one exists, so Option 1 tried: # BEGIN WordPress RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] # END WordPress RewriteEngine On RewriteCond %{HTTPS} ^a.com$ RewriteRule ^(.*)$ "https\:\/\/1\.b\.com\/$1" [R=301,L] option 2 tried: # BEGIN WordPress RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] RewriteCond %{HTTPS} ^a.com$ RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ "https\:\/\/1\.b\.com\/$1" [R=301,L] # END WordPress
    0
  • cPanelMichael
    You may receive more user-feedback for custom Mod_Rewrite rules on forums such as StackOverflow. Please update us on your findings after creating a new post there if the existing posts are unhelpful. Thank you.
    0
  • MaxFein
    So, I only noticed the thread was so old after I wrote this... I kinda really just wanted to put up something better so I went ahead =) Here is what I'd have tried: # Maybe uncomment engine and base, depends where you place this in the file # only need to turn on the engine once... #RewriteEngine On #RewriteBase / RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(.*)\ HTTP/ [NC] # Uncomment line below if you want this redirect to only apply to https requests #RewriteCond %{HTTPS} =on [NC] RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteCond %{HTTP_HOST} a\.com$ [NC] RewriteRule ^
    0
  • cPanelMichael
    Hello, Thank you for the update. Could you confirm if the updated rules work as expected? Thank you.
    0

Please sign in to leave a comment.