Home > OS >  Whole website redirects to wrong url, what could be causing this?
Whole website redirects to wrong url, what could be causing this?

Time:08-03

I recently moved one of my old sites to a new domain, because the old domain expired. Now on the new domain, I get an issue that the root URL seems to be: newdomain.com/newdomain/ So whenever I go to wp-admin, it redirects to newdomain.com/newdomain/wp-login.php. If I try to login, on newdomain.com/login.php, it redirects to newdomain.com/newdomain/login.php. I tried deactiving plugins/themes. And this problem persists. I updated the URL correctly in the database (siteurl and home) Has anyone ran into this situation? What could be causing this?

CodePudding user response:

If you have not set any redirection settings on your server, check .htaccess or nginx configuration file. For apache webservice, your .htaccess should be like below:

# BEGIN WordPress

RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

CodePudding user response:

Sounds like an issue within the database indeed. Most probably, your WordPress was not re-configured to properly use the new URL. You have to run a search and replace the OLD URL with the NEW ONE and clear your browser's/WP cache. You can also check the following guide on how to do that properly:

  • Related