Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Forcing single permalink wordpress page into SSL

Posted on 2015-02-06
9
Medium Priority
?
121 Views
Last Modified: 2015-02-23
I am trying to force http://www.mydomain.com/page to https://www.mydomain.com/page into ssl.  This is only a single permalink wordpress page.  In my .htaccess I have this  but it doesn't seem to work.  I am using the latest version of Wordpress

#Force secure Page/post
<ifmodule mod_rewrite.c>
RewriteEngine on
#If current port is 80 (http)
RewriteCond %{SERVER_PORT} ^80$
#Then rewrite to HTTPS
#replace URI after the ^ with your wordpress permalink
RewriteCond %{REQUEST_URI} ^/page
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .? https://%{HTTP_HOST}%{REQUEST_URI} [L,S=1,R=301]
</ifmodule>

#Escape secure form page/post
<ifmodule mod_rewrite.c>
#if current port is 443 (https)
RewriteCond %{SERVER_PORT} ^443$
#and you’re NOT on the page you specified above rewrite to http
#Replace URI after the ^ with the same permalink as above
RewriteCond %{REQUEST_URI} !^/page
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .? http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</ifmodule>

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

Open in new window

0
Comment
Question by:stargateatlantis
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 15

Expert Comment

by:Edwin Hoffer
ID: 40593785
Hello,

Try the below code in your .htaccess file:

Options +FollowSymLinks
RewriteEngine on

# redirect for http /buy page
RewriteCond %{SERVER_PORT} =80
RewriteRule ^page/?$ https://mydomain.com/page [R=301,QSA,L,NE]

Hope that helps you

Thanks
Edwin
0
 

Author Comment

by:stargateatlantis
ID: 40593858
I don't think that will work it probably has to do something with wordpresss.  I tried it in my code but it says page not found.

# 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]

Options +FollowSymLinks
# redirect for http /buy page
RewriteCond %{SERVER_PORT} =80
RewriteRule ^page/?$ https://mydomain.com/shop [R=301,QSA,L,NE]

</IfModule>

# END WordPress

Open in new window

0
 
LVL 15

Expert Comment

by:Edwin Hoffer
ID: 40593945
Change "page/" to your page name and mydomain.com/shop to your domain
0
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 

Author Comment

by:stargateatlantis
ID: 40593960
I tried that but it doesn't work

# 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]

Options +FollowSymLinks
# redirect for http /buy page
RewriteCond %{SERVER_PORT} =80
RewriteRule ^auth/?$ https://www.mydomain.com/auth [R=301,QSA,L,NE]

</IfModule>

# END WordPress

Open in new window

0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 40593971
Instead of screwing around with .htaccess, try this plugin:

https://wordpress.org/plugins/wordpress-https/

Just easier...
0
 

Author Comment

by:stargateatlantis
ID: 40593982
That plugin is out of date and hasn't been updated in while.
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 40594017
Nope.  It hasn't been updated because the functionality it provides doesn't need an update. We use it on all our sites and it's safe and secure.
0
 
LVL 15

Assisted Solution

by:Edwin Hoffer
Edwin Hoffer earned 1000 total points
ID: 40594064
Try this:

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


# force https for all URLs in /auth
RewriteCond %{HTTPS} =off
RewriteRule ^auth https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

</IfModule>

# END WordPress

Open in new window

0
 
LVL 18

Accepted Solution

by:
Lucas Bishop earned 1000 total points
ID: 40595278
RewriteCond %{SERVER_PORT} 80 
RewriteCond %{REQUEST_URI} page
RewriteRule ^(.*)$ https://www.mydomain.com/page/$1 [R,L]

Open in new window

0

Featured Post

Simplify Your Workload with One Tool

How do you combat today’s intelligent hacker while managing multiple domains and platforms? By simplifying your workload with one tool. With Lunarpages hosting through Plesk Onyx, you can:

Automate SSL generation and installation with two clicks
Experience total server control

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Do you think that WordPress is just for blogs?  Think again!  WordPress is really a fantastic all around platform that you can use to develop websites on.  Integrated into its basic functionality is the ability to create pages using your choice of a…
I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
The purpose of this video is to demonstrate how to automatically show related posts at the bottom of a blog post in WordPress. This will be demonstrated using a Windows 8 PC. Plugin “Yet Another Related Posts Plugin” will be used. Go to your…
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.
Suggested Courses
Course of the Month9 days, 16 hours left to enroll

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question