Forcing a page to redirect from http to https without a plugin?

I need to redirect this one page from http to https:
http://galuppis.com/online-forms/credit-card-authorization-form/

I tried using wordpress https but it doesnt work for some reason and it conflicts with woocommerce.

I searched the web and there are examples people use, but non work for me. I need help!

  • Aicee Taguilaso
    • WordPress Warrior

    Hi gediweb! :slight_smile:

    Hope you're well today!

    Could you try the solutions posted in here?
    https://premium.wpmudev.org/blog/ssl-https-wordpress/
    http://www.inmotionhosting.com/support/website/ssl/how-to-force-ssl-using-the-htaccess-file
    http://crunchify.com/wordpress-how-to-force-specific-pages-to-be-secure-ssl-https/
    http://stackoverflow.com/questions/85816/how-can-i-force-users-to-access-my-page-over-https-instead-of-http

    Always make sure to have a backup copy of the files you'll be modifying before changing it.

    Let me know how it goes. :slight_smile:

    Regards,
    Aicee

  • gediweb
    • Site Builder, Child of Zeus

    Hi Aicee,

    Thanks for the links.

    Here is the only thing that changed my url at all:

    RewriteEngine On
    RewriteCond %{SERVER_PORT} 80
    RewriteCond %{REQUEST_URI} online-forms/credit-card-authorization-form
    RewriteRule ^(.*)$ https://galuppis.com/online-forms/credit-card-authorization-form$1 [R,L]

    But http://galuppis.com/online-forms/credit-card-authorization-form changed it to:
    https://galuppis.com/online-forms/credit-card-authorization-formonline-forms/credit-card-authorization-formonline-forms/credit-card-authorization-formonline-forms/credit-card-authorization-formonline-forms/credit-card-authorization-formonline-forms/credit-card-authorization-formonline-forms/credit-card-authorization-formonline-forms/credit-card-authorization-formonline-forms/credit-card-authorization-formonline-forms/credit-card-authorization-formonline-forms/credit-card-authorization-formonline-forms/credit-card-authorization-form

    and then it says:

    This webpage has a redirect loop

    ERR_TOO_MANY_REDIRECTS

  • gediweb
    • Site Builder, Child of Zeus

    Yes of course

    RewriteEngine On
    RewriteCond %{SERVER_PORT} 80
    RewriteCond %{REQUEST_URI} online-forms/credit-card-authorization-form
    RewriteRule ^(.*)$ https://galuppis.com/online-forms/credit-card-authorization-form$1 [R,L]

    # BEGIN WPSuperCache
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    #If you serve pages from behind a proxy you may want to change 'RewriteCond %{HTTPS} on' to something more sensible
    AddDefaultCharset UTF-8
    RewriteCond %{REQUEST_URI} !^.*[^/]$
    RewriteCond %{REQUEST_URI} !^.*//.*$
    RewriteCond %{REQUEST_METHOD} !POST
    RewriteCond %{QUERY_STRING} !.*=.*
    RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$
    RewriteCond %{HTTP:X-Wap-Profile} !^[a-z0-9\"]+ [NC]
    RewriteCond %{HTTP:stuck_out_tongue:rofile} !^[a-z0-9\"]+ [NC]
    RewriteCond %{HTTP_USER_AGENT} !^.*(2.0\ MMP|240x320|400X240|AvantGo|BlackBerry|Blazer|Cellphone|Danger|DoCoMo|Elaine/3.0|EudoraWeb|Googlebot-Mobile|hiptop|IEMobile|KYOCERA/WX310K|LG/U990|MIDP-2.|MMEF20|MOT-V|NetFront|Newt|Nintendo\ Wii|Nitro|Nokia|Opera\ Mini|Palm|PlayStation\ Portable|portalmmm|Proxinet|ProxiNet|SHARP-TQ-GX10|SHG-i900|Small|SonyEricsson|Symbian\ OS|SymbianOS|TS21i-10|UP.Browser|UP.Link|webOS|Windows\ CE|WinWAP|YahooSeeker/M1A1-R2D2|iPhone|iPod|Android|BlackBerry9530|LG-TU915\ Obigo|LGE\ VX|webOS|Nokia5800).* [NC]
    RewriteCond %{HTTP_user_agent} !^(w3c\ |w3c-|acs-|alav|alca|amoi|audi|avan|benq|bird|blac|blaz|brew|cell|cldc|cmd-|dang|doco|eric|hipt|htc_|inno|ipaq|ipod|jigs|kddi|keji|leno|lg-c|lg-d|lg-g|lge-|lg/u|maui|maxo|midp|mits|mmef|mobi|mot-|moto|mwbp|nec-|newt|noki|palm|pana|pant|phil|play|port|prox|qwap|sage|sams|sany|sch-|sec-|send|seri|sgh-|shar|sie-|siem|smal|smar|sony|sph-|symb|t-mo|teli|tim-|tosh|tsm-|upg1|upsi|vk-v|voda|wap-|wapa|wapi|wapp|wapr|webc|winw|winw|xda\ |xda-).* [NC]
    RewriteCond %{HTTP:Accept-Encoding} gzip
    RewriteCond %{HTTPS} on
    RewriteCond %{DOCUMENT_ROOT}/hermes/bosnaweb01a/b2268/ipw.galuppis/public_html/wp-content/cache/supercache/%{SERVER_NAME}/$1/index-https.html.gz -f
    RewriteRule ^(.*) "/hermes/bosnaweb01a/b2268/ipw.galuppis/public_html/wp-content/cache/supercache/%{SERVER_NAME}/$1/index-https.html.gz" [L]

    RewriteCond %{REQUEST_URI} !^.*[^/]$
    RewriteCond %{REQUEST_URI} !^.*//.*$
    RewriteCond %{REQUEST_METHOD} !POST
    RewriteCond %{QUERY_STRING} !.*=.*
    RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$
    RewriteCond %{HTTP:X-Wap-Profile} !^[a-z0-9\"]+ [NC]
    RewriteCond %{HTTP:stuck_out_tongue:rofile} !^[a-z0-9\"]+ [NC]
    RewriteCond %{HTTP_USER_AGENT} !^.*(2.0\ MMP|240x320|400X240|AvantGo|BlackBerry|Blazer|Cellphone|Danger|DoCoMo|Elaine/3.0|EudoraWeb|Googlebot-Mobile|hiptop|IEMobile|KYOCERA/WX310K|LG/U990|MIDP-2.|MMEF20|MOT-V|NetFront|Newt|Nintendo\ Wii|Nitro|Nokia|Opera\ Mini|Palm|PlayStation\ Portable|portalmmm|Proxinet|ProxiNet|SHARP-TQ-GX10|SHG-i900|Small|SonyEricsson|Symbian\ OS|SymbianOS|TS21i-10|UP.Browser|UP.Link|webOS|Windows\ CE|WinWAP|YahooSeeker/M1A1-R2D2|iPhone|iPod|Android|BlackBerry9530|LG-TU915\ Obigo|LGE\ VX|webOS|Nokia5800).* [NC]
    RewriteCond %{HTTP_user_agent} !^(w3c\ |w3c-|acs-|alav|alca|amoi|audi|avan|benq|bird|blac|blaz|brew|cell|cldc|cmd-|dang|doco|eric|hipt|htc_|inno|ipaq|ipod|jigs|kddi|keji|leno|lg-c|lg-d|lg-g|lge-|lg/u|maui|maxo|midp|mits|mmef|mobi|mot-|moto|mwbp|nec-|newt|noki|palm|pana|pant|phil|play|port|prox|qwap|sage|sams|sany|sch-|sec-|send|seri|sgh-|shar|sie-|siem|smal|smar|sony|sph-|symb|t-mo|teli|tim-|tosh|tsm-|upg1|upsi|vk-v|voda|wap-|wapa|wapi|wapp|wapr|webc|winw|winw|xda\ |xda-).* [NC]
    RewriteCond %{HTTP:Accept-Encoding} gzip
    RewriteCond %{HTTPS} !on
    RewriteCond %{DOCUMENT_ROOT}/hermes/bosnaweb01a/b2268/ipw.galuppis/public_html/wp-content/cache/supercache/%{SERVER_NAME}/$1/index.html.gz -f
    RewriteRule ^(.*) "/hermes/bosnaweb01a/b2268/ipw.galuppis/public_html/wp-content/cache/supercache/%{SERVER_NAME}/$1/index.html.gz" [L]

    RewriteCond %{REQUEST_URI} !^.*[^/]$
    RewriteCond %{REQUEST_URI} !^.*//.*$
    RewriteCond %{REQUEST_METHOD} !POST
    RewriteCond %{QUERY_STRING} !.*=.*
    RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$
    RewriteCond %{HTTP:X-Wap-Profile} !^[a-z0-9\"]+ [NC]
    RewriteCond %{HTTP:stuck_out_tongue:rofile} !^[a-z0-9\"]+ [NC]
    RewriteCond %{HTTP_USER_AGENT} !^.*(2.0\ MMP|240x320|400X240|AvantGo|BlackBerry|Blazer|Cellphone|Danger|DoCoMo|Elaine/3.0|EudoraWeb|Googlebot-Mobile|hiptop|IEMobile|KYOCERA/WX310K|LG/U990|MIDP-2.|MMEF20|MOT-V|NetFront|Newt|Nintendo\ Wii|Nitro|Nokia|Opera\ Mini|Palm|PlayStation\ Portable|portalmmm|Proxinet|ProxiNet|SHARP-TQ-GX10|SHG-i900|Small|SonyEricsson|Symbian\ OS|SymbianOS|TS21i-10|UP.Browser|UP.Link|webOS|Windows\ CE|WinWAP|YahooSeeker/M1A1-R2D2|iPhone|iPod|Android|BlackBerry9530|LG-TU915\ Obigo|LGE\ VX|webOS|Nokia5800).* [NC]
    RewriteCond %{HTTP_user_agent} !^(w3c\ |w3c-|acs-|alav|alca|amoi|audi|avan|benq|bird|blac|blaz|brew|cell|cldc|cmd-|dang|doco|eric|hipt|htc_|inno|ipaq|ipod|jigs|kddi|keji|leno|lg-c|lg-d|lg-g|lge-|lg/u|maui|maxo|midp|mits|mmef|mobi|mot-|moto|mwbp|nec-|newt|noki|palm|pana|pant|phil|play|port|prox|qwap|sage|sams|sany|sch-|sec-|send|seri|sgh-|shar|sie-|siem|smal|smar|sony|sph-|symb|t-mo|teli|tim-|tosh|tsm-|upg1|upsi|vk-v|voda|wap-|wapa|wapi|wapp|wapr|webc|winw|winw|xda\ |xda-).* [NC]
    RewriteCond %{HTTPS} on
    RewriteCond %{DOCUMENT_ROOT}/hermes/bosnaweb01a/b2268/ipw.galuppis/public_html/wp-content/cache/supercache/%{SERVER_NAME}/$1/index-https.html -f
    RewriteRule ^(.*) "/hermes/bosnaweb01a/b2268/ipw.galuppis/public_html/wp-content/cache/supercache/%{SERVER_NAME}/$1/index-https.html" [L]

    RewriteCond %{REQUEST_URI} !^.*[^/]$
    RewriteCond %{REQUEST_URI} !^.*//.*$
    RewriteCond %{REQUEST_METHOD} !POST
    RewriteCond %{QUERY_STRING} !.*=.*
    RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$
    RewriteCond %{HTTP:X-Wap-Profile} !^[a-z0-9\"]+ [NC]
    RewriteCond %{HTTP:stuck_out_tongue:rofile} !^[a-z0-9\"]+ [NC]
    RewriteCond %{HTTP_USER_AGENT} !^.*(2.0\ MMP|240x320|400X240|AvantGo|BlackBerry|Blazer|Cellphone|Danger|DoCoMo|Elaine/3.0|EudoraWeb|Googlebot-Mobile|hiptop|IEMobile|KYOCERA/WX310K|LG/U990|MIDP-2.|MMEF20|MOT-V|NetFront|Newt|Nintendo\ Wii|Nitro|Nokia|Opera\ Mini|Palm|PlayStation\ Portable|portalmmm|Proxinet|ProxiNet|SHARP-TQ-GX10|SHG-i900|Small|SonyEricsson|Symbian\ OS|SymbianOS|TS21i-10|UP.Browser|UP.Link|webOS|Windows\ CE|WinWAP|YahooSeeker/M1A1-R2D2|iPhone|iPod|Android|BlackBerry9530|LG-TU915\ Obigo|LGE\ VX|webOS|Nokia5800).* [NC]
    RewriteCond %{HTTP_user_agent} !^(w3c\ |w3c-|acs-|alav|alca|amoi|audi|avan|benq|bird|blac|blaz|brew|cell|cldc|cmd-|dang|doco|eric|hipt|htc_|inno|ipaq|ipod|jigs|kddi|keji|leno|lg-c|lg-d|lg-g|lge-|lg/u|maui|maxo|midp|mits|mmef|mobi|mot-|moto|mwbp|nec-|newt|noki|palm|pana|pant|phil|play|port|prox|qwap|sage|sams|sany|sch-|sec-|send|seri|sgh-|shar|sie-|siem|smal|smar|sony|sph-|symb|t-mo|teli|tim-|tosh|tsm-|upg1|upsi|vk-v|voda|wap-|wapa|wapi|wapp|wapr|webc|winw|winw|xda\ |xda-).* [NC]
    RewriteCond %{HTTPS} !on
    RewriteCond %{DOCUMENT_ROOT}/hermes/bosnaweb01a/b2268/ipw.galuppis/public_html/wp-content/cache/supercache/%{SERVER_NAME}/$1/index.html -f
    RewriteRule ^(.*) "/hermes/bosnaweb01a/b2268/ipw.galuppis/public_html/wp-content/cache/supercache/%{SERVER_NAME}/$1/index.html" [L]
    </IfModule>

    # END WPSuperCache

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>

    # END WordPress

  • Aicee Taguilaso
    • WordPress Warrior

    Hi @gediweb!

    Please remove the lines you added before. Then, try adding these lines:

    RewriteCond %{SERVER_PORT} 80
    RewriteCond %{REQUEST_URI} online-forms/credit-card-authorization-form
    RewriteRule ^(.*)$ https://galuppis.com/online-forms/credit-card-authorization-form [R,L]

    Put it under RewriteRule ^index\.php$ - [L]

    Again, make sure to have a backup copy of the file.
    Let us know how it goes. :slight_smile:

    Regards,
    Aicee

  • gediweb
    • Site Builder, Child of Zeus

    sorry for the long gap in my replies.

    No matter what I do I cant get it to work. I even removed all the caching plugins. I tried deactivating all the plugins and still the same results.

    I tried wordpress https plugin and that did nothing. So now I have a plugin called Quick Page/Post Redirect Plugin and I tried doing a 301 redirect (also tried it directly from the htaccess file)

    I get the file redirecting to https now, but it gives me an error:
    This webpage has a redirect loop
    ERR_TOO_MANY_REDIRECTS

    I called the host (ipower web) and they see nothing wrong with the account. I refreshed the error logs and tried it again. The error logs remain blank, so not recording any errors.

    I just dont know what can be wrong?

  • Hoang Ngo
    • Code Slayer

    Hi @gediweb!

    The method

    RewriteCond %{SERVER_PORT} 80
    RewriteCond %{REQUEST_URI} online-forms/credit-card-authorization-form
    RewriteRule ^(.*)$ https://galuppis.com/online-forms/credit-card-authorization-form [R,L]

    Which Aicee suggested above should work for you, perhaps I think some plugins conflicted. I will need to take a look at your site for further debug. Can you please send in:

    - Mark to my attention - ATTN: Hoang Ngo
    - Link back to this thread
    - Include admin/network access
    - Include FTP
    - Include any relevant URLS for your site

    On the contact form, select "I have a different question", this ensures it comes through and gets assigned to me.

    Thanks!!.

    Best regards,
    Hoang

  • Ash
    • WordPress Hacker

    Hello @gediweb

    Do you have SSL installed? I can see the link is perfectly redirecting to https, but you will need SSL certificate installed in your server.

    Also, if I try to check https version of your home page, it redirects me to http version. Did you force from https to http too?

    Please let us know about this.

    Cheers
    Ash

  • gediweb
    • Site Builder, Child of Zeus

    Yes. Sure. If you look at https://galuppis.com/wp-login.php you'll see that the SSL is there and working a well as woo commerce. That's the weird part. Those are working.

    I didnt force https to http. I dont understand why the home page is doing that. Maybe there is something written into functions or configuration? I did have wordpress super cache and w3 total cache installed. Maybe they left residual files somewhere?

    Now I cant log into admin anymore. Not sure if @Hoang is working on it...

  • Hoang Ngo
    • Code Slayer

    Hi @gediweb,

    I hope you are well today and many thanks for your information.

    I can still logged in to your site. Also, I reverted the .htaccess to original, but I still get the redirect loop issues. Perhaps it's something in your code. Do you have any custom code, or wordpress code modification, or something similar? That's will help me much on tracking this issue :slight_smile:

    Thanks!

    Best regards,
    Hoang

  • gediweb
    • Site Builder, Child of Zeus

    @Hoang GOT IT!!! well almost...

    No custom coding in wordpress.

    But I ws thinking that the only other part of the site that's using https is woocommerce. So I looked at it's settings and there "Force HTTP when leaving the checkout " was checked!

    I unchecked it and https works! Now I still cant get it to redirect, but at least if I type https:// it now stays.

  • Hoang Ngo
    • Code Slayer

    Hi @gediweb,

    I hope you are well today.

    I re-applied the code above to your .htaccess, and now, the redirect should work :slight_smile:
    The current .htaccess code

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    
    RewriteCond %{SERVER_PORT} 80
    RewriteCond %{REQUEST_URI} online-forms/credit-card-authorization-form
    RewriteRule ^(.*)$ https://galuppis.com/online-forms/credit-card-authorization-form [R,L]
    
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress

    If you have any issues please don't hesitate to let us know so we can assist

    Best regards,
    Hoang

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.