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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:41:10+00:00 2026-06-17T05:41:10+00:00

I am trying to edit my .htaccess file in order to have users go

  • 0

I am trying to edit my .htaccess file in order to have users go through an SSL connection for some pages, and not for others.

For example, when visiting a page called login.php (which sometimes is login.php?lo=true) they enter in their log in details. After they visit login.php they then proceed to check_login.php and if they are successful they move on to index.php.

My question is this: How do I change my .htaccess file in order for the following to occur:

  • http://www.site.com/login.php —> https://www.site.com/login.php and if there are variables such as lo=true

  • http://www.site.com/check_login.php –> https://www.site.com/check_login.php

  • Any other page that is NOT login.php or check_login.php to be just http, not https

My knowledge of ModRewrite rules is limited and so far I have implemented the following:

RewriteCond %{HTTPS} !=on
RewriteRule ^login\.php$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteRule ^login\.php?lo=true$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Any help would be greatly appreciated.

  • 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-17T05:41:12+00:00Added an answer on June 17, 2026 at 5:41 am

    There is no need to worry about query strings unless you use a ? in the replacement URL. Below are the two sets of rules you need (the second set of rules is simply the opposite of first):

    RewriteCond %{HTTPS} !=on
    RewriteRule  ^(?:login\.php|check_login\.php)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=302,L]
    
    RewriteCond %{HTTPS} =on
    RewriteRule !^(?:login\.php|check_login\.php)$  http://%{HTTP_HOST}%{REQUEST_URI} [R=302,L]
    

    Note that I have used 302 redirects for testing. Do not forget to change to 301.

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

Sidebar

Related Questions

I'm trying to edit my .htaccess file to do the following: 1) Determine if
I have an .htaccess file that I'm trying to convert so it can be
I'm trying to user RewriteRule in my .htaccess file to redirect example.com/page to example.com/page.php
I'm currently trying to have my 1and1 host an .htaccess file with mod_rewrite enabled,
I'm trying to edit the httpd.conf file located in /private/etc/apache2, and I can't figure
I am trying to setup a proper .htaccess file, and what I mean by
i have the following line in my .htaccess file which is situated on my
I have been trying to write a set of htaccess rules that will do
I'm trying to get the following effect (using this local file http://localhost/[company_name]/[project_name]/.htaccess ): http://localhost/[company_name]/[project_name]/page-1
Having some issues with .htaccess on my website. I'm trying to alter the suffix

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.