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 6930737
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:29:13+00:00 2026-05-27T11:29:13+00:00

I got the basic Apache configuration more or less figured out with the guidance

  • 0

I got the basic Apache configuration more or less figured out with the guidance of the Apache manual but the redirection rules are a bit to complicated for me at this time so I hope you can help me.

I want to achieve the following:

  • Every incoming request over http should be redirected to use https.
  • Every subnet except for the ones defined as a vhost (m.domain.tld and content.domain.tld) should redirect to domain.tld.
  • I rather keep everything after the “/” but this isn’t necessary.

For example:

  • http:/domain.tld → https:/domain.tld
  • http:/whatever.domain.tld → https:/domain.tld
  • https:/whatever.domain.tld → https:/domain.tld
  • http:/m.domain.tld → https:/m.domain.tld

I got the basics working with this very basic rule but it only works for request coming in over http so non-existing subnets coming in over https aren’t reformatted.

<VirtualHost _default_:80>
    Redirect permanent / https://domain.tld/
</VirtualHost>

Hope you can help or point me in the direction of a clear guide (haven’t fount one yet).

  • 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-05-27T11:29:13+00:00Added an answer on May 27, 2026 at 11:29 am

    Try these mod_rewrite rules:

    RewriteEngine On
    Options +FollowSymLinks
    
    # force HTTPS for m.example.com
    RewriteCond %{HTTPS} !=on
    RewriteCond %{HTTP_HOST} =m.example.com
    RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
    
    # only allow m.example.com & example.com -- everything else gets redirected to https://example.com
    RewriteCond %{HTTPS} =on
    RewriteCond %{HTTP_HOST} !=m.example.com
    RewriteCond %{HTTP_HOST} !=example.com
    RewriteRule .* https://example.com%{REQUEST_URI} [R=301,L]
    
    # if still no HTTPS then force it (for any other subdomain)
    RewriteCond %{HTTPS} !=on
    RewriteRule .* https://example.com%{REQUEST_URI} [R=301,L]
    
    # your other rewrite rules below
    

    Keep in mind, that in order to be able to server something.example.com you need proper SSL certificate for that particular subdomain or wildcard SSL certificate that will cover ANY subdomain. It is important, as SSL part of HTTPS works way before mod_rewrite will have a chance to do anything (it only kicks in when secure connection is already properly established).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Very basic question - but I couldn't find an answer. I have got a
I've got the basic idea covered (I think), but can't seem to successfully post
I've got a basic UIScrollView displaying an image. Zooming in works fine but when
I got the basic understanding of AJAX down, but I am not sure if
This seems to be very basic question but I am knocked out. How to
I'm just starting to learn web dev, but got myself a bit confused when
I've got a basic MVC application - generated from the MVC application template. I've
I've got a basic HTTP client set up in C++, which works ok so
I have looked at Spring MVC a few times briefly, and got the basic
I've got a pretty basic question about how to start using Castle Windsor. I've

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.