Question

Wordpress cannot acces html

Posted March 8, 2021 208 views
WordPressLAMP StackLet's Encrypt

I cannot access my WordPress through HTTP, only works through HTTPS. I need to update the certification but certibot certifies through HTTP. The site is accessible through HTTPS, but screams “Danger, expired certificate.”

What can I try?

What I have tried.

  1. Changed .htaccess to not redirect to HTTPS.
  2. Changes the site to http://www.mysite.com in WordPress.
  3. Modified wp-config.php, define (“WP-SITEURL”,“WP_HOME”…

I did not change anything in MySQL, I am not familiar with SQL commands.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
2 answers

Hi @ALbundee,

It’s a possibility for the redirection to be made inside your virtual configuration file. If you are using an .htaccess file then it means you are using Apache. Find the Apache folder it’s usually:

for Ubuntu

/etc/apache2

for CentOS

/etc/httpd

Inside this folder, you should see another folder - sites-enabled. Find the Configuration file of your website there and please post it here. It’s possible the redirection is there and we might be able to spot it inside it.

  • Apologies for the delay.

    000-default.conf, I commented out the last few lines and rebooted the machine. No luck.

    # Added to mitigate CVE-2017-8295 vulnerability
    UseCanonicalName On
    
    <VirtualHost *:80>
            ServerAdmin webmaster@localhost
    
            ServerName www.example.co.za
            ServerAlias www.www.example.co.za
    
            DocumentRoot /var/www/html
    
            <Directory /var/www/html/>
                Options FollowSymLinks
                AllowOverride All
                Require all granted
            </Directory>
    
            ErrorLog ${APACHE_LOG_DIR}/error.log
            CustomLog ${APACHE_LOG_DIR}/access.log combined
    RewriteEngine on
    RewriteCond %{SERVER_NAME} =www.steedfit.co.za [OR]
    RewriteCond %{SERVER_NAME} =www.www.steedfit.co.za
    RewriteRule ^ http://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
    </VirtualHost>
    
    

    000-default-le-ssl.conf

    <IfModule mod_ssl.c>
    <VirtualHost *:443>
            ServerAdmin webmaster@localhost
    
            ServerName www.steedfit.co.za
            ServerAlias www.www.steedfit.co.za
    
            DocumentRoot /var/www/html
    
            <Directory /var/www/html/>
                Options FollowSymLinks
                AllowOverride All
                Require all granted
            </Directory>
    
            ErrorLog ${APACHE_LOG_DIR}/error.log
            CustomLog ${APACHE_LOG_DIR}/access.log combined
    
    Include /etc/letsencrypt/options-ssl-apache.conf
    ServerAlias steedfit.co.za
    SSLCertificateFile /etc/letsencrypt/live/www.steedfit.co.za-0001/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/www.steedfit.co.za-0001/privkey.pem
    </VirtualHost>
    </IfModule>
    
    

Hi @ALbundee,

I see something interesting.

In your <VirtualHost *:80>, I can see

ServerName www.example.co.za

Please make sure you update it with your domain as I can see you haven’t editted out the domain anywhere else.

Additionally, I’ll recommend adding the main domain name as well steedfit.co.za and not only the www version otherwise people that are trying to reach it on - steedfit.co.za will not be able to. You can add steedfit.co.za to your ServerAlias section.

Regards,
KFSys

  • Hey, sorry I should have mentioned that I changed that for privacy reasons. Not sure if this helps but I used the DO one-click WordPress image for setup so it did all those things for me.

    • Hi @ALbundee,

      I see, having said that, I can see the domain a little further back down the config file, if you wish to edit that.

      I can see you’ve added your main domain as well to your Apache Config file and everything seems to be working now.