problem Wordpress down after change url

July 17, 2019 259 views
WordPress Ubuntu 18.04

After changing the url of my wordpress installation from the local IP to domain name,
the wp-log or wp-admin site won´t load. The home page as well as the post are working but it is still showing the IP adress instead of the domain (but just showing, if I type in the domain name it directs me to the site).
Can anyone help me?

3 Answers

Did you updated the references in the database? You need to check the home and siteurl rows in the wp_options table (the table might have a different prefix, but you need to access the options table). The references need to match the domain name. If they’re still set with the IP address, change them to the actual domain name.

    • Good. What about the virtual host? Can you check if this is still configured with the IP address and not the domain name?

      • also added this to wp-config

        define(‘WPHOME’,’https://bloger.armadillorent.com’);
        define('WP
        SITEURL’,’https://bloger.armadillorent.com’);

        Change the rows in wp-options and wp-post to the custom domain.

        The following code is in /etc/apache2/sites-available/blog.armadillorent.com.conf

        <VirtualHost *:80>
        ServerAdmin theramedia@157.230.135.230
        ServerName http://bloger.armadillorent.com
        ServerAlias bloger.armadillorent.com www.bloger.armadillorent.com *.bloger.armadillorent.com armadillorent.com/bloger

        DocumentRoot /var/www/blog.armadillorent.com/html
        
            <Directory /var/www/blog.armadillorent.com/html/>
                Options FollowSymLinks
                AllowOverride All
                Require all granted
            </Directory>
        
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
        

        </VirtualHost>

      • it is alredy set

        serveradmin webmaster@localhost
        servername bloger.armadillorent.com
        serveralias bloger.armadillorent.com

        • Are you using .htaccess file? As this might be an issue where the site can’t rewrite the requests through the index.php file in the WordPress home dir. The default WordPress .htaccess file is:

          BEGIN WordPress

          <IfModule mod_rewrite.c>
          RewriteEngine On
          RewriteBase /
          RewriteCond %{REQUESTFILENAME} !-f
          RewriteCond %{REQUEST
          FILENAME} !-d
          RewriteRule . /index.php [L]
          </IfModule>

          END WordPress

          Of course mod_rewrite needs to be installed and enabled as well.

          • yes that is exactly how my htaccess looks, thank you for the advices.
            I´m really looking forward to complete this task, is there any information I can gave you to help you help me?

Can you check your wp-config.php file for references of the IP address? Also if you can explain what have you done when changing the site name from the IP address to the domain name, as in this way we will know for sure what it’s already done.

  • You can also perform search and replace for your database in order to update all the references for the IP in the database and replace with the new domain name. You can do this either using a plugin or do it manually, basically it’s up to you. Let me know if you’re not familiar with the process and I can give you step by step guide to do this.

    You can also easily check if this is needed by simply going in phpMyadmin and search for the IP address in your database. If you see references for the IP, then perform the search and replace so you can update those to match the domain name.

    You need to take a backup of your database before you start in order to have a copy in case something goes wrong.

    Let me know if you have any questions.
    Alex

Did you updated the home and siteurl references in the wp_options table in the database? They need to match the domain name.
You can easily check/update this via phpMyadmin –> https://manage.accuwebhosting.com/kb-images/change-siteurls/siteurl-home.png

  • yes I updated them as well as the wp_post, but still showing the ip adress and i cant login to dashboard.
    I still have access to the files and the database.

    Also tried configuring the wp-config hardcoding adding
    define( ‘WPHOME’, ’http://example.com’ );
    define( 'WP
    SITEURL’, ’http://example.com’ );

    still not working.

    • Can you please check the database and search for the IP address in it? You can also easily check if this is needed by simply going in phpMyadmin and search for the IP address in your database. If you see references for the IP, then perform the search and replace so you can update those to match the domain name.

      You need to take a backup of your database before you start in order to have a copy in case something goes wrong.

      Let me know if you have any questions.
      Alex

      • the only item showing the ip in database, is in wpoptions, called itsectempwhitelistip.
        Everything else is changed, also alredy used the search and replace and succesfully replace the old url.

        1.- The first thing i did was changing the home url and the site url, from the ip adress to the domain. Then logged me out of the page, the page broke, theme deprecated as well as posts, and I cant login because the login page never loads.

        2.- Then I added in the wp-config the home url and the site url, it didnt work.

        3.-Changed the .conf file of the, in the sites-available, in apache2. changed the servername, and server alias from IP to the domain

        4- I went to the database, php myadmin and change all the url, from the ip to the domain, also used the search and replace plugin via cli to make sure everything is changed, and yes it is. also in the site health info tab, everything is how its suposed to be.

        5.- The page works again, posts, theme and everything, but I still CANT login and still shows the Ip adress, when I type in the domain.

        6.- Then I changed everything again from domain to IP adress, and everything is working fine again.
        Also at this point if I type in the domain it directs me to the page, but obviously because the domain is pointing to the IP adress.

        Thanks again, Alex

        • You can give it another try if you wish. I also have a step by step guide I can paste here if you wish. If you’re using any control panel you can try changing the IP to match the domain name from there as this in theory will set the virtual host as well.

          Let me know if you have any questions.
          Alex

Have another answer? Share your knowledge.