Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8094305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:45:32+00:00 2026-06-05T20:45:32+00:00

I am trying to force HTTPS on a domain. It must be done using

  • 0

I am trying to force HTTPS on a domain. It must be done using a method that works by domain name and not port number (due to host structure/setup).

My closest attempt was:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^mydomain.com$
RewriteRule ^.*$ https://www.mydomain.com/$1 [R=301,L]

This works when typing “mydomain.com” into the address bar, automatically redirecting to “https://mydomain.com” but when I type “www.mydomain.com” it does not work. I assume it is a syntax issue as I am very new to htaccess and have spent about 4 hours trying to create a solution from other’s code.

Any chance of a pointer?


To make the setup a little more understandable.

/public_html/ – All files in this folder relate to www.mydomain.com
/public_html/subfolder – These folders contain files also relating to mydomain.com
/public_html/subdomain – These folders contain files relating to www.myotherdomain.com

My other domains are subdomains of mydomain.com for to be listed in the cpanel on the host.
For example: subdomain.mydomain.com is the same as www.myotherdomain.com.

Hopefully that clears up the structure.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T20:45:33+00:00Added an answer on June 5, 2026 at 8:45 pm

    Your redirect happens whenever a request is made to the exact domain mydomain.com (that’s what the RewriteCond is testing for). It doesn’t apply to any other domains and doesn’t detect HTTPS. Use this instead:

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^(www.)?mydomain.com$
    RewriteCond %{HTTPS} off
    RewriteRule ^(.*)$ https://www.mydomain.com/$1 [R=301,L]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have ONE directory for my entire domain that I want to force https,
I'm having hard time trying to force https (ssl) to particular page on codeiginiter
I have a PHP script being served over https:// that is trying to push
I'm trying to force Jetty to only use HTTPS (or redirect to HTTPS from
I am trying to force a table row that only contains images to be
I'm trying to implement a force base graph layout algorithm, based on http://en.wikipedia.org/wiki/Force-based_algorithms_(graph_drawing )
Following a d3 demonstration ( http://goo.gl/lN7Jo ), I am trying to create a force-directed
I'm trying to force an inherited class to use a custom attribute. I'm creating
I am trying to force an iframe to the exact same height as the
I'm trying to force ssl on certain pages, but also on a directory. But

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.