Does anyone have a sample .htaccess for SSL/HTTPS for one page? (4 posts)

  1. frontdesk
    Posted 6 years ago #

    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?

  2. pcmehrdad
    Posted 6 years ago #

    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!

  3. RedeemedLife
    Posted 6 years ago #

    Didn't change anything for me. :(

  4. RedeemedLife
    Posted 6 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic