• Dear All,
    I’d like to improve the security of my wordpress site and
    I thought to Let’s Encrypt Certificate.

    So I’ve generated the certificate with certbot-auto
    I’ve modified wp-config.php replacing http with https and I
    also changed the .htaccess adding these lines:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{SERVER_PORT} 80
    RewriteRule ^(.*)$ https://mysite.com/$1 [R,L]
    </IfModule>

    but after that I don’t see my home because there are some
    redirect issue.

    Does Anybody help me ?

    How many mod_rewrite must be in the .htaccess ?

    Thanks a lot.
    Best Regards
    Willy

Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    Please provide a link to a page on your site where we can see this. Thanks.

    Also, remove that redirect stanza from .htaccess and let’s see if the site works.

    Thread Starter willy70

    (@willy70)

    Dear Steve dear all,
    I found this guide https://www.wpbeginner.com/wp-tutorials/how-to-add-ssl-and-https-in-wordpress/ and I followed it to configure my
    website that was already functioning without SSL.

    The first thing I did was install of letsencrypt
    using certbot-auto generating: private, the request and the
    certificate. This utility did not make any changes to
    the apache configuration because I did it myself.

    If you still have some time for me I would be grateful. These
    are some configuration files of the linux server running apache 2.2.

    /etc/httpd/conf/httpd.conf:
    … omissis
    ServerRoot “/ etc / httpd”
    ….
    Listen 80
    ….
    #ServerName https://www.example.com:80
    UseCanonicalName Off
    DocumentRoot “/ var / www / html”
    <Directory “/ var / www / html”>
    … omissis

    inside this file there are no references for wordpress.

    The file /etc/httpd/conf.d/ssl.conf is:

    LoadModule ssl_module modules / mod_ssl.so
    #
    # When we also provide SSL we have to listen to the
    # the HTTPS port in addition.
    #
    Listen 443
    ….
    <VirtualHost _default_: 443>
    # General setup for the virtual host, inherited from global configuration
    #DocumentRoot “/ var / www / html”
    #ServerName https://www.example.com:443
    SSLEngine on
    SSLCertificateFile /etc/letsencrypt/live/atleticaumbertide.it/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/atleticaumbertide.it/privkey.pem

    </ VirtualHost>

    And the configuration file /var/www/html/.htaccess in the wordpress directory:

    # BEGIN iThemes Security – Do not modify or remove this line
    # iThemes Security Config Details: 2
    # Quick ban IP. Will be updated on next formal rules save.
    SetEnvIF REMOTE_ADDR “^185\.13\.39\.246$” DenyAccess
    SetEnvIF X-FORWARDED-FOR “^185\.13\.39\.246$” DenyAccess
    SetEnvIF X-CLUSTER-CLIENT-IP “^185\.13\.39\.246$” DenyAccess
    <IfModule mod_authz_core.c>
    <RequireAll>
    Require all granted
    Require not env DenyAccess
    Require not ip 185.13.39.246
    </RequireAll>
    </IfModule>
    …omissis….
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ – [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    …omissis….

    And the last one wp-config.php:

    ….
    define(‘WP_HOME’,’https://atleticaumbertide.it&#8217;);
    define(‘WP_SITEURL’,’https://atleticaumbertide.it&#8217;);
    …..
    define(‘FORCE_SSL_ADMIN’, true);

    So if I replace “RewriteBase” standard rules from .htaccess adding the new
    entry:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{SERVER_PORT} 80
    RewriteRule ^(.*)$ https://www.yoursite.com/$1 [R,L]
    </IfModule>

    web site will be not accesible.

    Any ideas ?
    Thanks a lot
    Best Regards
    Willy

    • This reply was modified 6 years, 10 months ago by willy70.
    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    It seems you’ve been blindly copying and pasting. That generally leads to a poor outcome.

    You do not need to use “FORCE_SSL”, nor do you need to edit wp-config.php. Use this script to search for https://example.com and replace with https://example.com:

    https://interconnectit.com/products/search-and-replace-for-wordpress-databases/

    On sites I make SSL, I add this to .htaccess:

    RewriteEngine On 
    RewriteCond %{SERVER_PORT} 80 
    RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]

    This is my httpd config https://gist.github.com/sterndata/55bac4f1d833421203cff7816e2f5276

    You probably do not need / should not use lines 26-28

    Thread Starter willy70

    (@willy70)

    Dear Steve,
    can you send me your .htaccess ?
    Thanks a lot again.
    Best Regards
    Willy

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    I have the relevant part of my .htaccess above.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Help for https’ is closed to new replies.