Support » Fixing WordPress » Home page always redirects to subfolder

  • dave517

    (@dave517)


    Hello,

    I messed up something with WordPress. When I want to access example.com it redirects to my previous subfolder example.com/test

    In WP in settings I change URL to example.com, also in options I change the 2 values which have addresses if they have example.com.

    But my home page still redirects to example.com/test When I click on for example Contact us, I get to example.com/contact, so that’s working fine.

    On the FTP I have the page in the root and also in root/test. But I’m afraid to delete root/test (the subfolder), because Im afraid I will not be able to access my site completely.

    Any idea how could I fix this issue?

    Thanks!
    Dave

    • This topic was modified 3 years ago by dave517.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator t-p

    (@t-p)

    – Using FTP/ SFTP , or your web-host’s cPanel or whatever file management application your host provides, access phpMyAdmin on your host, then find your DB, there check the wp_options Table (Note: The table prefix of wp_ may be different if you changed it when installing), and make sure siteurl field and home field are correct. See https://codex.wordpress.org/Changing_The_Site_URL#Changing_the_URL_directly_in_the_database
    If you haven’t already done, always backup your database before doing any actions, just in case something really goes wrong. You can never have enough backups!

    cjc1867

    (@cjc1867)

    So Dave was your WordPress installed in example.com\test and now you want to access it from example.com instead?

    By Changing it in WordPress is not going to work as you need to copy index.php and .htaccess from the test directory and paste it into the root. Then you need to edit the index.php file so that it points to the test folder.

    See this on the Codex: https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory

    I use method 2.

    Thread Starter dave517

    (@dave517)

    Hello!

    Thanks for your replies.

    So first I installed my WP in the root directory, but then I wanted to move it to root/test, because I wanted people who access the site example.com to be redirected to a FB page. And I wanted to able to keep developing the site on the address example.com/test.

    So I copied everything from root to the subfolder, with changing information in WP settings and also htaccess. But I found out, that it’s not really possible to redirect people from example.com to FB page and have a functioning site on example.com/test (or at least I wasn’t able to do it). So I wanted to reverse everything.

    I copied the content from the subfolder to the root, tried to set back everything (WP settings, htaccess) and I also added a rule to htaccess which redirects all the IPs to the FB page, except mine. But still after that, the homepage wasn’t really showing.

    Then I tried it on my different notebook. Lo and behold, it was working there. Thanks to that I figured out, that probably I needed to clear my cache. After doing that it is now working just fine.

    After all it seems like I did everything right regarding the migration of the site (thanks Google!), but clearing the cache on my notebook was the culprit.

    Anyway, thanks for your help, guys!

    Have a nice day!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Home page always redirects to subfolder’ is closed to new replies.