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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:54:06+00:00 2026-05-24T23:54:06+00:00

I have ssl enabled on whole website, but I need to force all pages

  • 0

I have ssl enabled on whole website, but I need to force all pages except login.php and register.php to http://

So basically I only need login.php and register.php pages to be https:// protocol-ed.

Right now I have script that makes login.php page https:// encrypted , but I don’t understand how to add register.php to this code

Options +FollowSymLinks 
RewriteEngine On

RewriteBase /

# Turn SSL on for payments
RewriteCond %{HTTPS} off
RewriteCond %{SCRIPT_FILENAME} \/login\.php [NC]
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]

# Turn SSL off everything but payments
RewriteCond %{HTTPS} on
RewriteCond %{SCRIPT_FILENAME} !\/login\.php [NC]
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [R=301,L]

Any ideas on how to edi/make this code to set login.php and register.php pages to https:// and all others to http://

Thank you

  • 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-24T23:54:07+00:00Added an answer on May 24, 2026 at 11:54 pm

    If you are familiar with mod_rewrite and regex a little bit, you should have no problems reading these rules — comments are present explaining what particular rule does. the rest — regex basics:

    Options +FollowSymLinks -MultiViews
    RewriteEngine On
    RewriteBase /
    
    # force https for /login.php and /register.php
    RewriteCond %{HTTPS} =off
    RewriteRule ^(login|register)\.php$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
    
    # don't do anything for images/css/js (leave protocol as is)
    RewriteRule \.(gif|jpe?g|png|css|js)$ - [NC,L]
    
    # force http for all other URLs
    RewriteCond %{HTTPS} =on
    RewriteCond %{REQUEST_URI} !^/(login|register)\.php$
    RewriteRule .* http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
    
    1. These rules need to be placed in .htaccess in website root folder BEFORE any other rewrite rules (if such present). If placed elsewhere some small tweaking may be required.

    2. They will

      • force HTTPS for /login.php and /register.php,
      • do nothing for images, css styles and JavaScript files (to be precise, for files with those extensions)
      • and will force HTTP for all other URLs
    3. You can easily add other URLs to that list — just edit existing rule by adding additional file name to the list (the same text in 2 places: 1) to force 2) to exclude)

    4. File names are case-sensitive. So these rules will not work if /LOGIN.php is requested (Apache will not serve it either, as Linux is case-sensitive OS .. so no need to worry much here).

    5. Obvious thing: mod_rewrite should be enabled and .htaccess files needs to be processed by Apache (some website hosting companies disabling them for performance and security reasons).

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

Sidebar

Related Questions

I have followed all the instructions here: http://www.tonyspencer.com/2003/10/22/curl-with-php-and-apache-on-windows/ to install & config apache get
I have a website with apache 1.3(SSL enabled) + mod_jk + tomcat 5.5 on
Possible Duplicate: .htaccess Problem - ( Turn off SSL for every page except login.php
I have Apache2 SSL which is fronting Spring webapp as follows: ProxyPass / http://localhost:8080/
We have not purchased an SSL certificate so the user of our website has
I have a website which allows secure (ssl) file uploads and download. The site
I have SSL enabled for subdomain.mydomain.com so I can access files via https://subdomain.mydomain.com .
I have a couple questions about SSL certificates. I never used them before but
I have web service deployed in Web Sphere and this service is SSL enabled.
I have a SharePoint web app that has SSL enabled and a desktop application

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.