Solved

Forcing single permalink wordpress page into SSL

Posted on 2015-02-06
9
117 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 14

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 14

Expert Comment

by:Edwin Hoffer
ID: 40593945
Change "page/" to your page name and mydomain.com/shop to your domain
0
Save the day with this special offer from ATEN!

Save 30% on the CV211 using promo code EXPERTS30 now through April 30th. The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

 

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 14

Assisted Solution

by:Edwin Hoffer
Edwin Hoffer earned 250 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 17

Accepted Solution

by:
Lucas Bishop earned 250 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

Easy, flexible multimedia distribution & control

Coming soon!  Ideal for large-scale A/V applications, ATEN's VM3200 Modular Matrix Switch is an all-in-one solution that simplifies video wall integration. Easily customize display layouts to see what you want, how you want it in 4k.

Question has a verified solution.

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

Suggested Solutions

What's this? As a volunteer Page Editor for Experts-Exchange.com, I have noticed that many authors also have blogs, and pull articles from their blogs to post at Experts-Exchange. I appreciate each author sharing their blog content with our site …
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…
The purpose of this video is to demonstrate how to insert an Iframe into WordPress. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Open Page or Post…
The purpose of this video is to demonstrate how to Import and export files in WordPress. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Click on Too…

696 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