The standard problem of moving the WP installation from the root into the my_subdir folder keeping the url www.example.com.

Regarding the article Moving a Root install to its own directory, Method I (Without URL change)

  • After Installing the wordpress in root folder, move EVERYTHING from root folder into subdirectory
  • Create a .htaccess file in root folder, and put this content inside (just change example.com and my_subdir)

These instructions simply do not work. They are even inconsistent with the article Moving Wordpress!

Do somebody have the correct instructions?

  • Should i change the siteurl and home DB options?
  • Should i change the original .htaccess created by WP when updating the Permalinks?
  • Should i change the index.php last line to include the my_subdir?
  • Can the hosting be messing something disabling the functionality of the .htaccess around?

Update: Both Method I and Method II keep failing at the last step of logging in back. I am following the exact steps, and no, something in the new version of WP is messing with the subfolder installation (what?).

  • 1
    Do you want to put WP in a sub directory but still be able to browse it without using that sub directory? If so, why?
    – janh
    Commented Nov 6, 2017 at 17:21
  • 1
    Just to clarify, you want to move WP into a subdirectory, but you want just the homepage to be at the root domain? WP is either in a subdirectory or not. If WP is your full website, it would be better to either leave it in the root directory or move it completely. When you move it completely you can create a redirect so that people who go to www.example.com go straight to www.example.com/my_subdir to view the site. Perhaps you could provide more information about why you are looking for this solution so we can understand better and offer more help.
    – WebElaine
    Commented Nov 6, 2017 at 17:28
  • I am just follow whe Method I guide, keeping the URL www.example.com, moving WP from Root into my_subdir
    – Brethlosze
    Commented Nov 6, 2017 at 17:31
  • 1
    I agree with WebElaine, it is not clear what you're trying to accomplish. Forget about the articles and concentrate your question on what you're trying to do (as opposed to explaining within the context of possibly unrelated articles).
    – Tony M
    Commented Nov 6, 2017 at 17:45
  • Ok, i am looking for moving the WP installation from the Root public_http into a my_subdir folder, and keeping the www.example.com original url. The motivation is to keep several WP installations, for different subdomains.
    – Brethlosze
    Commented Nov 6, 2017 at 17:47

1 Answer 1


Here is the instructions if we suppose that you intially installed your site into ROOT folder (in the link you provided it's the method called Method II (With URL change) ).

There are two important steps and between them your site may break but it's not an issue :

I) First you need to update the link in the settings of your site. But you only need to update the WordPress Address (URL) by adding the subdirectory at the end to make it like this www.yoursite.com/subdir.

Now your site can stop working but no worries.

II) Second move all your files to the subdir then copy .htaccess file and index.php file from subdir and put them into the root directory (copy them and don't move them back you need to have a copy in root and a copy in subdir).

Open index.php file you moved to root and make these changes :

require( dirname( __FILE__ ) . '/wp-blog-header.php' );


require( dirname( __FILE__ ) . '/subdir/wp-blog-header.php' );

After this we are done, now you simply need to login to your site and save permalink structure again (without doing any changes) to be sure the url rewriting is updated correctly.

NOTE that your new admin access will be : www.yoursite.com/subdir/wp-admin.

I also advice you to clear your cookies and cache after migration to avoid any issues.

  • I am following these steps each time but i only get an OOPS! THAT PAGE CAN’T BE FOUND. (in caps) message from WP each time i try to access subdir/wp-admin. So i cannot finish the process.
    – Brethlosze
    Commented Nov 6, 2017 at 18:36
  • 1
    @hyprfrcb You did update the index.php ? and you cleared your cache/cookies ? Commented Nov 6, 2017 at 18:37
  • Yes. i just opened in another browser. Nothing
    – Brethlosze
    Commented Nov 6, 2017 at 18:40
  • @hyprfrcb ok let's follow together and you will get the issue. So you updated the link before doing the file changes ? the right one ? and the site broke after ? Commented Nov 6, 2017 at 18:41
  • 1
    @hyprfrcb am pretty sure it's the II as the I doens't change the url and cookies are always impacted by url changing Commented Nov 7, 2017 at 14:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.