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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T12:16:11+00:00 2026-05-13T12:16:11+00:00

Here is the code I have currently in my .htaccess file: Options +FollowSymLinks RewriteEngine

  • 0

Here is the code I have currently in my .htaccess file:

Options +FollowSymLinks 
RewriteEngine on
RewriteBase / 
RewriteCond %{HTTP_HOST} ^example.com [NC] 
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]

RewriteEngine On
RewriteCond %{HTTPS} on
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

I know jack about rewrites…and all of the other posts on this subject really don’t fit my criteria and I don’t know enough about the language to try and decipher it.

Basically what I need is this:

  1. redirect all instances of “example.com” to “www.example.com”
  2. redirect all instances of “https//www.example.com” to “http://www.example.com” with the exception of 1 page!!!! (in case it matters, the filename of that page is payments.php)

The code I have above works, but for the 1 page that I need to be https, it is rewriting the url to http. That one page has to be https.

Thanks,
Chris

  • 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-13T12:16:11+00:00Added an answer on May 13, 2026 at 12:16 pm

    Apache/2.2.6 (Win32) mod_ssl/2.2.8 OpenSSL/0.9.8g PHP/5.2.6

    I’ve tested it locally, all use cases seem to work fine. If you have further questions, feel free to ask.

    # Rewrite Rules for example.com
    RewriteEngine On
    RewriteBase /
    
    # Redirect from example.com to www.example.com
    RewriteCond %{HTTP_HOST} ^example\.com [NC]
    RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
    
    # Turn SSL on for payments
    RewriteCond %{HTTPS} off
    RewriteCond %{SCRIPT_FILENAME} \/payments\.php [NC]
    RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
    
    # Turn SSL off everything but payments
    RewriteCond %{HTTPS} on
    RewriteCond %{SCRIPT_FILENAME} !\/payments\.php [NC]
    RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [R=301,L]
    

    IMPORTANT! When the user navigates from any https page with www to any https page without www, he’s asked to accept security certificate of your non-www domain.

    For example (YES = request to accept the certificate, NO – opposite):

    1) https://www.asdf.com/payments.php - YES (www.asdf.com)
    2) http://www.asdf.com/phpinfo.php - NO
    3) https://asdf.com/phpinfo.php - YES (asdf.com)
    4) https://www.asdf.com/phpinfo.php - NO
    

    I tried to reorder rules in .htaccess with no success. If anyone finds a better solution, it’ll be highly appreciated.

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

Sidebar

Related Questions

I currently have a complete cover background image. Here is the code: #back{ /*
I have a relatively complex .htaccess file to control page requests, this currently redirects
I have a site that currently serves results as example.com/index.php?show=foo and I'd like it
Here's the mod_rewrite portion of my .htaccess Options +FollowSymlinks Options -Indexes # Prevent Direct
I have a little bit of Javascript that almost works correctly. Here's the code:
enter code here I have a table on SQL server 2005 with bigint primary
Here is the code I have to create an UIAlertView with a textbox. UIAlertView
Here's the code I have: var commandsBuffer = List[String]() commandsBuffer ::= cmd.exe commandsBuffer ::=
Here's the code I have: from cStringIO import StringIO from lxml import etree xml
enter code here I have a ListView that have a different Layout XML for

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.