admin管理员组

文章数量:1122846

I am trying to install wordpress into a subdirectory of a website.

I simply want to build the client's new site in this subdirectory, so a separate and new WP install in this subdirectory, and then when complete, delete the current (old) site and move the new wp website from the subdirectory to the root.

I've uploaded the wordpress into the subdirectory, I've completed the wp-config file, created my database... and I have double-checked and triple checked that my database name, user and password are the same in my config file as in my database.

Reading the codex it appears I need to change the path in the index.php file, which I've done:

require( dirname( __FILE__ ) . '/subdirectory_name/index.php' 

when I go to the subdirectory to complete the WP install I get the following error message:

Fatal error: require() [function.require]: Failed opening required '/home/user/public_html/subdirectory_name/index.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/user/public_html/subdirectory_name/index.php on line 17

Any suggestions as to what I am doing wrong?

Does it matter that the client's current site is a Joomla site? Help is very much appreciated!

I am trying to install wordpress into a subdirectory of a website.

I simply want to build the client's new site in this subdirectory, so a separate and new WP install in this subdirectory, and then when complete, delete the current (old) site and move the new wp website from the subdirectory to the root.

I've uploaded the wordpress into the subdirectory, I've completed the wp-config file, created my database... and I have double-checked and triple checked that my database name, user and password are the same in my config file as in my database.

Reading the codex it appears I need to change the path in the index.php file, which I've done:

require( dirname( __FILE__ ) . '/subdirectory_name/index.php' 

when I go to the subdirectory to complete the WP install I get the following error message:

Fatal error: require() [function.require]: Failed opening required '/home/user/public_html/subdirectory_name/index.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/user/public_html/subdirectory_name/index.php on line 17

Any suggestions as to what I am doing wrong?

Does it matter that the client's current site is a Joomla site? Help is very much appreciated!

Share Improve this question edited Jul 30, 2014 at 4:02 markratledge 8,7356 gold badges40 silver badges62 bronze badges asked Jul 1, 2014 at 3:37 ccbarccbar 151 gold badge2 silver badges12 bronze badges 1
  • Create a sub domain if you can. Like wp.example.com – Amirking Commented Oct 30, 2019 at 1:51
Add a comment  | 

5 Answers 5

Reset to default 0

To build a separate site in the domainname.com/subdirectory_name directory while leaving the current site live at domainname.com, you would NOT want to modify the index.php file in the root. Your development site address is simply domainname.com/subdirectory_name

Just create a sub directory in your domain root with somename "dev" and put your wordpress files under this directory. Now if your domain name is http://example.com and you have setup under dev directory .

Just hit http://example.com/dev, It will automatically show you install.php to install your wordpress in the current directory.

I had a similar situation. Have you have checked that in Dashboard>Settings>General Settings Wordpress Address(URL) and Site Address(URL) are the same. That is where my issue was.

Apparently when zipping my wp folder and expanding it through cpanel>file manager, something wasn't working.

If I didn't zip my wp folder and simply uploaded it to the directory, the WP install in the subdirectory worked perfectly.

The best explanation with examples is in WordPress documents Giving WordPress Its Own Directory

本文标签: installationInstalling WordPress in a subdirectory