i had a wordpress website on xampp let's say in "localhost/listing" and it was working perfectly then i installed another copy of this website on "localhost/mylisting" now the problem is that when i type "localhost/listing/wp-admin" the site redirects itself to "localhost/mylisting/wp-admin" i dont know how to solve this problem. i tried making another directory and copying all contents on listing in it and the problem was same.
i had a wordpress website on xampp let's say in "localhost/listing" and it was working perfectly then i installed another copy of this website on "localhost/mylisting" now the problem is that when i type "localhost/listing/wp-admin" the site redirects itself to "localhost/mylisting/wp-admin" i dont know how to solve this problem. i tried making another directory and copying all contents on listing in it and the problem was same.
Share Improve this question edited May 12, 2019 at 12:57 fuxia♦ 107k39 gold badges255 silver badges459 bronze badges asked May 12, 2019 at 12:36 Hamed PourgholyHamed Pourgholy 31 bronze badge2 Answers
Reset to default 0It's because your new copy of the site localhost/mylisting
is still hooked into same database as localhost/listing
.
So to avoid that, you have to point your new installation to a different database. to do that, goto your phpmyadmin and export your current db, then create new empty db and import into it. then goto newly imported db's wp-options table. change siteURL and homepage URL to localhost/mylisting
from localhost/listing
.
Change the site url and home url.The problem is database have the old url address thats why you are facing this problem. You can use this code in wp-config file and change url accordingly.
define('WP_HOME','http://example');
define('WP_SITEURL','http://example');
define('RELOCATE',true);