We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 31902
    • 342 Posts
    I'm trying to get one page (contact-us.html) to be secure (HTTPS) when you go to it but not any of the other pages on the site. And, when you leave that page to go to any other page, the resulting pages should no longer be secure. I've tried the following without any success:

    1. Using Redirector to redirect the page from contact-us.html to https://www.sample.com/contact-us.html

    2. Create a weblink (site is using Wayfinder) to go directly to https://www.sample.com/contact-us.html. What this ends up doing is flipping it to HTTPS, but when I go back to another page, it stays in HTTPS and the site no longer displays any styles...like it doesn't see any CSS or js files. When I then clear site cache, it normals the site up.

    3. Within the .htaccess file, I tried the following code:

    # Redirect from example.com to www.example.com
    RewriteCond %{HTTP_HOST} ^contact-us\.html [NC]
    RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
    
    # Turn SSL on for contact-us.html
    RewriteCond %{HTTPS} off
    RewriteCond %{SCRIPT_FILENAME} \/contact-us\.html [NC]
    RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
    
    # Turn SSL off everything but contact-us.html
    RewriteCond %{HTTPS} on
    RewriteCond %{SCRIPT_FILENAME} !\/contact-us\.html [NC]
    RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [R=301,L]
    


    ...with no effect.

    4. Within .htaccess file, I tried the following code:

    #this page has to be on https
    RewriteCond %{SERVER_PORT} !^443$ 
    RewriteCond %{HTTPS} !on
    RewriteCond %{REQUEST_URI} ^/contact-us.html$ [NC] 
    RewriteRule ^(.*)$ https://www.example.com/$1 [L,R=301]
    
    #this page has to be on https
    RewriteCond %{SERVER_PORT} !^443$ 
    RewriteCond %{HTTPS} !on
    RewriteCond %{REQUEST_URI} ^/contact-us.html$ [NC] 
    RewriteRule ^(.*)$ https://www.example.com/$1 [L,R=301]
     
    
    #all other pages have to be on http
    RewriteCond %{SERVER_PORT} ^443$  [OR]
    RewriteCond %{HTTPS} on
    RewriteCond %{REQUEST_URI} !^/contact-us.html$ [NC]
    RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301] 
    
    


    ...also with no effect.

    5. Within .htaccess file, I tried the following code:

    RewriteRule ^contact-us.html https://www.sample.com/contact-us.html [L,NC,R=301]
    


    ...also with no effect.

    Can anyone please help? Thank you in advance.

    Running:
    MODx 2.1.3-pl
    Wayfinder 2.3.3
    Redirector 1.0.3
    PHP Version 5.2.10 [ed. note: waizen last edited this post 12 years, 3 months ago.]