Reputation: 795
I have a wordpress blog and I need to make one of the pages secure. I have been told to make the link to that page point to https://claimpage.html as opposed to http://claimpage.html.
The problem is I don't actually create the menu that links the user to the individual pages. This is done automatically by the code in the background. I think I need to put in some sort of an IF statement, saying, if the title of the page is "claim now" then use https otherwise use http.
I found this code in the header.php so I think my changes need to go in here but I'm not really sure what to do.
<div id="navbar">
<ul class="menu">
<li class="<?php if ( is_home() ) { ?>current_page_item<?php } else { ?>page_item<?php } ?>"><a href="<?php echo get_settings('home'); ?>"><?php _e('Home'); ?></a></li>
<?php wp_list_pages('sort_column=id&depth=1&title_li='); ?>
<?php wp_register('<li>','</li>'); ?>
</ul>
</div> <!-- end of #navbar -->
Any suggestions as to how I can make one page that I know the title and url or https while the others are kept using normal http?
The site is hosted on a secure server so I do have an ssl certificate.
Upvotes: 0
Views: 363
Reputation: 6555
Following on from prodigitalson's idea. You can add this to your .htaccess:
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^claimpage.html https://claimpage.html [R=301,L]
That should do the trick.
Upvotes: 2
Reputation: 25244
if you only have one language and your link to this site is static paste it statically into your theme.
<div id="navbar">
<ul class="menu">
<li class="<?php if ( is_home() ) { ?>current_page_item<?php } else { ?>page_item<?php } ?>"><a href="<?php echo get_settings('home'); ?>"><?php _e('Home'); ?></a></li>
<?php wp_list_pages('sort_column=id&depth=1&title_li='); ?>
<?php wp_register('<li>','</li>'); ?>
<li><a href="https://yoursecurelink">my secure link</a></li>
</ul>
</div> <!-- end of #navbar -->
there is no need for regex, IF or ELSE, or something. your link is statically i think, so just paste it in.
Upvotes: 0
Reputation: 60413
Use a Rewrite rule or RedirectMatch in your .htaccess. That will take care if redirecting the link without modifying the code.
Upvotes: 0