WordPress.org

Ready to get started?Download WordPress

Forums

Running WP from a domain subdirectory (7 posts)

  1. chuckbutler
    Member
    Posted 1 year ago #

    Hi,

    Let me state right up front that I'm not an IT professional.

    I admin our company's in-house server, a MacMini running SL server (10.6.8), serving 3 virtual hosts for web, mail, and ftp. No problems. I created the sites we run using GoLive and now Dreamweaver; they are fairly simple and never required WP.

    We are now working with a web design company to revamp our main site and incorporate some more advanced functionality. They asked me to install WP, which I was able to do successfully within the root directory of our main site. So on our server there is a secondary hard drive containing a "websites" folder, and within that folder, separate folders for each of the domains we're hosting. The path to our main domain looks something like this:

    /Volumes/secondaryharddrive/websites/domain1

    I dropped all the WP files loose into the domain1 folder, followed all the setup instructions, and was able to complete the WP install by accessing this URL:

    http://www.domain1:8888/wp-admin/install.php

    All good so far--but here's the part I can't figure out. The web design company asked me to create a subdirectory within our domain1 folder that they could use for testing pages as they develop the new site. So I created a subdirectory called "testing":

    /websites/domain1/testing

    Now they are saying that they need WP installed and running *within* that folder, rather than in the root folder of the domain. I can't figure out how to make that happen.

    Here's what I tried. I moved all WP files into the "testing" subdirectory. I then went into phpMyAdmin, deleted the user and database I had made for WP, and recreated it. This allowed me to run a fresh WP install. But this time I would have thought the "testing" subdirectory would have to be included in the install URL, like this:

    http://www.domain1:8888/testing/wp-admin/install.php

    But that URL doesn't work, and I don't know why. I wonder if it's because in the edited wp-config file I created I'm specifying DB_HOST as 'localhost', and this is preventing WP install from looking to the "testing" subdirectory? Or do I need to specify something in ABSPATH, since I'm no longer at the domain root?

    Here's what's even weirder. I discovered that if I use the original install path:

    http://www.domain1:8888 (I don't even have to include the "/wp-admin/install.php" part)

    I'm taken to the WP admin setup, which I can run successfully. Now, I'm not clear on how that's possible, since the WP files are in the "testing" subdirectory. And maybe I've actually already accomplished what I was attempting. But I think not, because when I log in to WP admin and look at Settings > General, it's showing my WP Address as

    http://www.domain1.com:8888

    Whereas if I had accomplished my goal I should think it would read:

    http://www.domain1.com:8888/testing

    If anyone can shed any light on this, I'd truly appreciate it. Just please bear in mind that I am not an IT professional, so things that may seem obvious to someone who fully understands this stuff may not be obvious to me.

    Thanks in advance!

  2. Abhishek Ghosh
    Member
    Posted 1 year ago #

    Basically your public folders are :

    |-domain1 (directory)--testing (subdirectory)
    |
    |-domain2 (not yet created, for example)

    http://www.domain1:8888/testing/wp-admin/install.php

    Try without port :

    http://www.domain1/testing/wp-admin/install.php

    Settings > General, it's showing my WP Address as

    Change it to : http://www.domain1.com

    Just report back after changing it and testing.
    BTW, are you are covered with Apple Care protection/ is it still its active ?

    (Taking that you have fully qualified domain names)

  3. chuckbutler
    Member
    Posted 1 year ago #

    Thanks for responding, Abhishek! And thanks to you or whoever moved my post into this forum. As a newbie I did not recognize that this was the proper location.

    To answer your last questions first, yes I have fully qualified domain names and yes I have AppleCare (which I believe is still active, though I'm not sure how this is relevant to the issue at hand).

    You have understood the folder structure correctly:

    domain1 (directory) > testing (subdirectory)

    1. All of the files for the current website are in the "domain1" directory. All of the files for the new website will be in the "testing" subdirectory until we are ready to go live. All WP files currently reside in the "testing" subdirectory.

    2. Re the port issue. When I originally got WP running in the "domain1" directory, I discovered that I could only access the WP setup screen if I included the :8888 port reference in the URL. I now suspect this is because I used MAMP to install php and SQL on the server; MAMP defaults to using port 8888 for Apache and 8889 for SQL. Today I changed these to Apache on port 80 and SQL on port 3306. See results below.

    3. MAMP also requires that I set a Document Root for Apache. I currently have it set to my "testing" subdirectory, but perhaps this is the wrong approach. Perhaps it should be set to a "neutral" location outside of any web domain folder? I'm not clear about what's required for all of this to work correctly.

    4. In any case, by changing the Apache port to 8888, I am able to access the WP setup screen without specifying a port, as you describe above. BUT--I still cannot access the setup screen if I include the /testing/ subdirectory in the URL. I find this very strange, because, as I said, all the WP files are *in* the "testing" subdirectory. So, IOW, if I use the URL you suggested:

    http://www.domain1.com/testing/wp-admin/install.php

    I get: "Not Found The requested URL /testing/wp-admin/install.php was not found on this server". I assure you that the directory exists and all of the WP files are in it. On the other hand, if I format the URL like this:

    http://www.domain1.com/wp-admin/install.php

    (excluding the /testing/ subdirectory), I get the expected WP setup screen. And in fact I can go ahead and complete the WP install. But then when I look at Settings > General in WP, it shows my WP address as:

    http://www.domain1.com

    Note that it no longer includes the port, which I think is because I changed the Apache port setting in MAMP. But it does not specify the /testing subdirectory, which is what we want. So apparently WP setup recognizes that the WP files are in a subdirectory within the domain1 domain, but it assumes that the setup should reference the main domain1 directory rather than the subdirectory containing the WP files? I don't understand why it would make that assumption, but I assume I'm doing something wrong.

    And given the above, I'm not sure whether you want me to change the WP Address in Settings > General or not. It seems to me that I'll know this is set up correctly when I open General > Settings after an install and find the WP Address as

    http://www.domain1.com/testing

    Right?? And then we should be good to go from there.

    5. But there is a big problem with all of the above, because when I change the Apache port from 8888 to 80, we can no longer access our existing website! All web queries for domain1 return the generic "just another WP site" screen. So obviously we need a solution that will allow us to test our WP site within the "testing" subdirectory without interfering with traffic to our existing site in the "domain1" directory.

    And this brings me to a final question . . .

    5. At some point we'll have all the files for our new site in the "testing" subdirectory, and when we're ready to go live we'll need to move all of this up in to the main "domain1" directory (replacing the files for the existing site). So what's going to happen re WP when we do that? Will I have to reinstall WP at that directory? Will I be able to move the database I created using phpMyAdmin (and is this a reason to create the directory in a "neutral" location as I asked above)? The big picture here is that everything we get working in the "testing" subdirectory will eventually need to move to and work within the "domain1" directory. So I ask all of the above with that in mind.

    Thanks again for any help you can provide. Sorry for so many questions.

  4. Abhishek Ghosh
    Member
    Posted 1 year ago #

    and yes I have AppleCare (which I believe is still active, though I'm not sure how this is relevant to the issue at hand).

    You will get the support for all Network Services for Snow Leopard Server.
    Officially :

    "AppleCare OS Support delivers support for advanced server operation, including network configuration and administration and the integration of OS X Server into heterogeneous environments."

    MAMP is not mandatory to run server. With few needed packages, you can actually run Mac-Apache2-MySQL-PHP server. Basically the router will allow the outsiders to browse the directories.

    Basically you problem is not with WordPress, but with the server setup. Apart from AppleCare, obviously you will get help from community, for example this tagged threads :

    https://discussions.apple.com/community/mac_os/mac_os_x_v10.7_lion?view=tags&tags=lion_server

    Kindly understand - the thing is actually going towards OS X configuration instead of WordPress. Personally I think you must seek for an UNIX expert for the proper setup (be it AppleCare or any other) for security reasons.

  5. chuckbutler
    Member
    Posted 1 year ago #

    Well, as I expected Apple Enterprise support claims they don't know anything about WP or how it should be installed.

    The part that I find frustrating here is that I do appear to have a working WP install. What's strange is that all of my WP files are in the /testing subdirectory I mentioned, and yet when I run wp-admin/install.php it only works if I use

    http://www.domain1.com:8888/wp-admin/install.php

    After the install is complete, WP shows both the WP and Site address as

    http://www.domain1.com:8888

    Any attempt to incorporate /testing into the URL returns a Not Found error ("/testing/wp-admin/install/php was not found on this server"--despite the fact that that's exactly where the file resides. It's as though the WP installer doesn't care that the WP files are in the subdirectory and proceeds as though they are in the main site directory.

    Not sure what else to try. May have to give up and pay a hosting service that has the functionality in place. Bummer; really wanted to get this working.

  6. chuckbutler
    Member
    Posted 1 year ago #

    Tried one other thing; it didn't work, but maybe provides some clue to a person more knowledgeable than I.

    I removed WP and deleted my SQL database. Then I did a fresh WP install in the domain1 directory (not the /testing subdirectory). Got this all up and running.

    Then I followed the instructions on moving a root install to a subdirectory, editing the copy of the index.php file in my main directory to require the ./testing subdirectory.

    When I then attempted to login using

    http://www.domain1.com:8888/testing/wp-login.php

    I didn't get a "Not Found" error--IOW, this was seen as a valid URL. Unfortunately it only returned a blank page; it did not load the admin interface. It's like there nothing to tell the index.php file in the domain1 directory to look to the index.php file in the /testing subdirectory.

    I'm almost wondering if this could be some kind of permissions issue. But if I place a random file in my testing folder, call it "testdoc.docx", I can access the file as expected:

    http://www.domain1.com/testing/testdoc.docx

    I should think that would rule out a permissions issue. Hmmm.

  7. chuckbutler
    Member
    Posted 1 year ago #

    The workaround I eventually found was to create an alternate root level directory on an alternate port and install WP at that location. This avoided the subdirectory issue, and when the new site is complete, I'll just target domain1 to that directory.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.