This is actually the code I've presently during 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 understand jack about rewrites...and the many other posts about this subject really do not fit my criteria and I'm not sure enough concerning the language to decipher it.

Essentially things i require is this:

  1. redirect all cases of "example.com" to "world wide web.example.com"
  2. redirect all cases of "https//world wide web.example.com" to "http://world wide web.example.com" except for 1 page!!!! (just in case it matters, the filename of this page is obligations.php)

The code I've above works, as well as the 1 page that I have to be https, it's spinning the hyperlink to http. That certain page needs to be https.

Thanks, Chris

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

I have examined it in your area, all use cases appear to operate fine. For those who have further questions, you can request.

# 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! Once the user navigates from the https page with world wide web to the https page without world wide web, he's requested to simply accept security certificate of the non-world wide web domain.

For instance (YES = request to simply 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 attempted to reorder rules inshtaccess without results. If anybody finds a much better solution, it will be highly appreciated.

# 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.example.com/$1 [R=301,L]

# Disable SSL on pages other than payments.php
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} !^payments\.php$
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]

# Require SSL on payments.php
RewriteCond %{HTTPS} !on
RewriteCond %{REQUEST_URI} ^payments\.php$
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]

I've not examined it but something of that nature should work

Edit: Up-to-date

additionally to william's great solution, you are able to negate request uri somewhere before https rewriterule

RewriteCond %{REQUEST_URI} !^/?payments\.php