WordPress.org

Ready to get started?Download WordPress

Forums

Run WP in subdirectory - not just install it there (12 posts)

  1. cbobson
    Member
    Posted 2 years ago #

    Does anyone know how to install the entire WP site structure in a sub-directory and have it work exclusively from there. That means the index.php resides there too.

    We want visitors to view our primary site at http://www.example.com and then if they want to read our blog, http://www.example.com/blog/. These two sites have different designs and should be completely separate, except for links to navigate back and forth.

  2. stvwlf
    Member
    Posted 2 years ago #

    You can put one WordPress installation in the root folder and another in folder /blog/ Those two will work fine.

  3. cbobson
    Member
    Posted 2 years ago #

    Thanks, but I have been trying to do that without success. Do you know the process flow for installing in that subdirectory?

  4. stvwlf
    Member
    Posted 2 years ago #

    What is the problem you are having with getting the two installs working? WordPress works that way out of the box, no special settings are needed.

    On each site WordPress Address and Site address will be the same as each other -
    In the top level one, both should be http://www.example.com
    In the blog, both should be http://www.example.com/blog

    That means that index.php in the top level install will be in http://www.example.com/

    and index.php in the blog install will be in http://www.example.com/blog

    If you really can't get it going, you could also do this with a two site WordPress MultiSite install. Use a subfolder install - the top level will be the root site at http://www.example.com and the blog will be a regular site with subfolder of blog
    You can assign each site its own theme in MultiSite.

  5. Does anyone know how to install the entire WP site structure in a sub-directory and have it work exclusively from there. That means the index.php resides there too.

    You mean... just install WP in /blog/ and run Multisite?

    Because that works out of the box and isn't really a Multisite 'question.' It just works :D

    We want visitors to view our primary site at http://www.example.com and then if they want to read our blog, http://www.example.com/blog/. These two sites have different designs and should be completely separate, except for links to navigate back and forth.

    The catch with using Multisite for this (and you can) is that BLOG is a restricted slug that is used for your main install. So any blog posts for example.com will be example.com/blog/postname

    If that's not a problem, then just go forth and Multisite ;) If it IS a problem, then you get some shenanigans with stuff.

  6. cbobson
    Member
    Posted 2 years ago #

    Thanks again, but this does not work right out of the box. We only want one blog in a subdirectory named /news/

    I manage several WP themes and have installed successfully in top level and top level with content in subdirectory. But having a real challenge getting WP to run entirely in the subdirectory.

    Keep in mind, I do not want the index.php in the top level.

    I've installed again in the directory and get this error:

    Warning: require(/var/www/vhosts/mydomain.com/httpdocs/news/wp-includes/load.php) [function.require]: failed to open stream: No such file or directory in /var/www/vhosts/mydomain.com/httpdocs/news/wp-settings.php on line 21

    Fatal error: require() [function.require]: Failed opening required '/var/www/vhosts/maydomain.com/httpdocs/news/wp-includes/load.php' (include_path='.:') in /var/www/vhosts/mydomain.com/httpdocs/news/wp-settings.php on line 21

  7. We only want one blog in a subdirectory named /news/

    It works out of the box. I do it all the time.

    1) Copy all the files into the /news/ folder
    2) Run the installer.

    That's it. Where are you getting the errors?

    Also I don't see how this is a MULTISITE question. If it's not, let me know and I'll move this out to the general install section for you.

  8. cbobson
    Member
    Posted 2 years ago #

    I reinstalled for the fourth time, created a new db and was able to install. The installs kept giving the error as listed in my previous post. So the 'works out of the box' comment is not what I saw.

    However, even though the WP URL and Site URL are both set up properly (ie. http://www.mydomain.com/news/), when I create a new Post or Page it loads in http://www.mydomain.com/ and pulls an error. It is not keeping the subdirectory path for any posts or pages.

    btw, this is a mutli question because we have two sites trying to run on the same domain and if we can get it to work we will have a third and may need to do a multisite install. But we need these issues resolved first.

  9. Again. You're doing 'something' wrong. Not being there, I cannot possibly tell you what.

    Let's step back.

    What's installed in domain.com ?

    If it's WordPress, why are we installing a second instance? That's not Multisite.

    Multisite is not "I have multiple separate installs of WP." It's "I have ONE install of WP, and use it to support multiple sites, added on to that one install."

    So... y'know, what's goin on? :)

  10. cbobson
    Member
    Posted 2 years ago #

    Thanks for the clarification. The site is arcannahomes.com. We are installing a WP blog for them and want it to run in the subdirectory /news/. We want to provide a link to it from the primary site which resides in the root directory. We do not want to replace the index.php file in the root because that points to the primary site.

    After several install attempts, we were able to get WP running in this directory. However, the Posts and Pages were not resolving to the proper path, even though the settings within the WP interface include the path [eg. arcannahomes.com/news/].

    In attempting a resolution, we modified the permalinks to /%category%/%postname%/. We then updated the .htaccess file to include the script that was offered.

    Currently the subdirectory is experiencing an internal server error. We have removed the .htaccess modification but are still unable to log back in. We will reboot server and restart computer and clear browser cache and re-attemt.

    It is obvious that the current issue is determining the proper script and location for the .htaccess (root or sub dir?). Where do you recommend we install that file and with which script based on the permalink structure would work in this instance.

    Thanks again!

  11. cbobson
    Member
    Posted 2 years ago #

    By deleting the script provided for the .htaccess file update we were able to gain access to the directory.

    However, the primary issue still remained, the pages did not resolve.

    We then chmod 777 to the .htaccess and decided to let WP update the file automatically, thinking our manual update changed the owner or the permissions. [we will revert this to 755].

    We also added 'news' to the optional Category Base field in the Permalinks settings.

    To our joy, this finally gave us the service we were hoping for. We now have a top level or root site running separately from a WordPress blog in a subdirectory.

    We intend to replicate this on another site and see if the process goes any different.

  12. Two things to look into.

    1) Make sure the WP .htaccess is in the /news/ folder, and that it's got the RewriteBase set (correctly) to /news/

    2) Make sure, in the / folder, that there isn't an .htaccess there causing conflicts.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.