Home WordPress: Site is HTTPS; redirect only one site page over HTTP
Reply: 1

WordPress: Site is HTTPS; redirect only one site page over HTTP

rmenes379
1#
rmenes379 Published in 2017-12-05 19:32:01Z

I'm trying to get a website I'm administrating to redirect only one page over HTTP, while the rest of the site will be sent over HTTPS.

The server is an Ubuntu Server 16.04.3 setup, with WordPress 4.9 installed. The certificate is from Let's Encrypt.

According to another post I was reading, one of the solutions given was to add something similar to the following code in the site's .htaccess file:

# redirects non-www page requests to www version
RewriteCond %{HTTP_HOST} ^mywebsite\.com$ [NC]
RewriteRule (.*) http://www.mywebsite.com/$1 [R=301,L,NE]

# adds a trailing slash
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ /$1/ [R=301,L]

# 3 pages to be on https
RewriteCond %{HTTPS} off 
RewriteCond %{REQUEST_URI} ^/(order-form|employment-
application|about/contact-us)/ [NC]
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [L,R=301,NE]

# All other pages have to be on http
RewriteCond %{HTTPS} on 
RewriteCond %{REQUEST_URI} !^/(order-form|employment-
application|about/contact-us)/ [NC]
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [L,R=301,NE]

However, after applying this solution and restarting the apache server, the entire site went into a state of constant redirects and timeouts. As mentioned, I just need one page and one page only to be on HTTP, and the rest of the site can safely be on HTTPS. Any solutions would be greatly appreciated.

plushyObject
2#
plushyObject Reply to 2017-12-06 06:03:19Z

Personally, I would try to come up with an alternative way to pull in that resource from wherever it lives on HTTP. Is it a script? An image? There has to be a better way to pull it.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.317363 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO