WordPress.org

Support

Support » How-To and Troubleshooting » Does anyone have a sample .htaccess for SSL/HTTPS for one page?

Does anyone have a sample .htaccess for SSL/HTTPS for one page?

  • I have a new WP site at godaddy with an SSL certificate, and I want to code an .htaccess file that…

    1) is SEO friendly, and
    2) forces SSL on only one of my site’s pages (a contact form), and
    3) forces SSL on all WP-ADMIN pages

    For the ‘SEO friendly’ requirement I would like to map ALL of the following 6 URIs to map to the same page:

    – mydomain.com
    http://www.mydomain.com
    http://mydomain.com
    http://www.mydomain.com
    https://mydomain.com
    https://www.mydomain.com

    …should ALL map to http://www.mydomain.com/

    Also, all subpages of this domain should similarly be mapped:

    – mydomain.com/otherpage to http://www.mydomain.com/otherpage/

    Note, too, that the trailing “/’ should be appended in all cases except when the URI ends in a file extension (such as “.html” or “.htm”)

    There would only be one page that I want to force to use HTTPS:

    – mydomain.com/contact should map to https://www.mydomain.com/contact/

    …and all other permutations of “/contact” in the URI should map to that same “https://www.mydomain.com/contact/” SSL page.

    Finally, the other exception would be to force WP-ADMIN pages to all use SSL (i.e., force SSL for admin logins and dashboard maintenance)

    Does anyone have a .htaccess for WP that will do these options?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Once you checked that your webserver can handle SSL, opne your wp-config.php file (Located at the root of your WordPress install) and paste the following:

    define(‘FORCE_SSL_ADMIN’, true);
    Save the file, and you’re done!

    Didn’t change anything for me. 🙁

    Well actually, my admin pages are all https now, but not any of the pages of the site.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Does anyone have a sample .htaccess for SSL/HTTPS for one page?’ is closed to new replies.