Enable WordPress SSL with Apache and mod_ssl

Enable WordPress SSL with Apache and mod_ssl

Overview

How to enable SSL encryption on a WordPress site using Apache and mod_ssl, with options for securing just the login page, the admin area, or the entire site.

Apache Settings

  1. Install mod_ssl for Apache (on CentOS): ```bash yum install mod_ssl
2. Edit /etc/httpd/conf.d/ssl.conf and add your Certificate Files: ```apache
ServerName server.domain:443 SSLCertificateFile /path/to/cert/server.domain.crt SSLCertificateKeyFile /path/to/cert/server.domain.key SSLCertificateChainFile /path/to/cert/server.domain.ca-bundle

Login Encryption

Edit wp-config.php before the: php /\* That's all, stop editing! Happy blogging. \*/ Add the next Line: ```php define(‘FORCE_SSL_LOGIN’, true);


# Entire Admin Area Encryption

Edit wp-config.php before the: ```php
/\* That's all, stop editing! Happy blogging. \*/
``` Add the next Line: ```php
define('FORCE\_SSL\_ADMIN', true);

Entire WordPress Encryption

Edit wp-config.php before the: php /\* That's all, stop editing! Happy blogging. \*/ Add the next Line: ```php define(‘FORCE_SSL_ADMIN’, true);


## Option 1 - edit httpd.conf

Edit /etc/httpd/conf/httpd.conf and add the next line to your WordPress virtual host: ```apache
Redirect permanent / https://myserver.example.com/
``` Restart Apache httpd service: ```bash
httpd restart

Option 2 - edit .htaccess

Edit .htaccess and Add the next lines: ```apache RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://myserver.example.com/$1 [R,L]


Enjoy WordPress SSL