WordPress.org

Forums

home_url() trouble: Home page displays "Index of /wp/" also rewriting urls (30 posts)

  1. cindy c
    Member
    Posted 1 year ago #

    Hi!
    I have 2 questions regarding my multisite install. I'm using a child theme that I created off the Quark theme. There are no posts, comments, or blog issues - it's just website pages, a.k.a. "faux-static" pages.

    My three sites are functional, but one will not display the home page. The network home site (http://djxstation.com/) displays the correct home page both in the menu and via the logo in the header masthead. The 2nd site (http://partisound.com/) also correctly displays the home page, but my 3rd site (http://autodjpac.com/) will not display the home page - only a listing of the index directory, and a link up to the parent directory. I can manually type in the urls of the rest of the pages on that site, but any home links go back to the directory listing. Here is the home page for reference: http://djxstation.com/wp/autodjpac/home/

    At one point I managed to create a "new" home page and replace it in the menu, but the home_url function still calls the directory listing. I'm not getting the home page to display and I think it's related to the home_url() function. I am stumped, and I'm afraid to change something deep in the template files and affect all three sites.

    My other problem is about the urls themselves, but not permalinks.
    I need to rewrite the urls somehow without messing everything up.
    These 3 sites are running off one install, with the 1st one as the main network site. I want the urls to stand alone as below, rather than the redirects I put into my host CPanel:
    http://djxstation.com/ vs.
    http://djxstation.com/wp/;

    http://partisound.com/ vs. http://djxstation.com/wp/partisound/
    http://autodjpac.com/ vs. http://djxstation.com/wp/autodjpac/home/

    Is this a multisite issue or just wordpress? Please let me know if I need to provide additional info, and thanks for looking at my post/question!!
    Cindy

  2. ... will not display the home page - only a listing of the index directory, and a link up to the parent directory

    Are these cPanel add-on domains? In your cPanel go to Addon Domains and make sure that the Document Root is set to /public_html. My thought is that it's set to something like /public_html/domain.com. That should fix both of your points.

    Edit: Didn't notice this the first time through, but your WP install is in /wp/ right? In that case you can't map domains. It's a limitation.

  3. cindy c
    Member
    Posted 1 year ago #

    Hi Patrick, thanks for your reply!
    Yes, WP is install is in /wp/ directory at the top level.

    The document root for djxstation.com (addon domain) is
    /public_html/djxstation.com and I have a redirect to http://djxstation.com/wp/home/

    Document root for autodjpac.com was
    /public_html/autodjpac.com/home-2
    and not redirected. Hmm, that home-2 was my attempt to create a new home page. I removed it, but still get the index of /wp/autodjpac and no home page.

    Should I remove the "domain.com" after /public_html/ or is there a problem that you can't map domains? I'm not really sure what that means. Is there any way to re-write or re-direct so these websites look like their own websites and not part of some conglomerate? Or, do I need to ditch everything I've done and reinstall WP into the top level vs. in its own directory? That seems incredibly messy!
    Thanks again,
    Cindy

  4. Should I remove the "domain.com" after /public_html/ or is there a problem that you can't map domains? I'm not really sure what that means.

    Unfortunately it's only possible to map additional domains if WordPress is installed in the root directory of /public_html. If WordPress is in any other folder, like /wp/, the http://wordpress.org/plugins/wordpress-mu-domain-mapping/ plugin won't work.

    This actually isn't really specified on that Domain Mapping plugin page(s). I just added a note .

    So you can either move /public_html/wp/ to /public_html/ (which is much trickier than it sounds) -- see http://halfelf.org/2012/moving-wordpress-multisite/, or leave it like it is :(

  5. cindy c
    Member
    Posted 1 year ago #

    I don't recall adding the mu-domain-mapping plugin. How can you tell I'm using that? I didn't specifically install it.

    Is there any other way around this, such as domain mod-rewrite-engines or anything like that?
    Otherwise, I've seen the nightmarishly long posts about moving the wordpress install and having trouble connecting to the database again. Is it even more complicated moving the multisite? The problem is, I'm quite sure my client won't be ok with super-long piggy-backed URLs for the separate sites.

    Another Question: Is it easier to make a "backup" of the wp install and files, then uninstall it and reinstall it at the top level? Or is that the 15-step process? Have people been successful moving the install up a level in a multisite install? And, if I do that, will the domain mapping actually work? I would hate to spend days moving and troubleshooting and re-setting-up the entire thing if it I still won't be able to point my domain to a different URL.
    Thank you.

  6. I don't recall adding the mu-domain-mapping plugin. How can you tell I'm using that? I didn't specifically install it.

    Well if you want to map domains to Multisite member sites then using that plugin is basically the only way to do it. There's stuff that actually gets changed in the database so a rewrite tool doesn't solve the entire challenge. If you can find a clean solution you'd be famous!

    Well no matter what you do, take a backup first. I would say it's easier to follow the guide rather than re-installing WordPress.

    I would hate to spend days moving and troubleshooting and re-setting-up the entire thing if it I still won't be able to point my domain to a different URL.

    If you move it to /public_html you'll be able to map domainX.com to domain.com/siteX or siteX.domain.com, etc.

  7. cindy c
    Member
    Posted 1 year ago #

    my 3rd site (http://autodjpac.com/) will not display the home page - only a listing of the index directory, and a link up to the parent directory. I can manually type in the urls of the rest of the pages on that site, but any home links go back to the directory listing. Here is the home page for reference: http://djxstation.com/wp/autodjpac/home/

    I just realized that the link to the home page that I can't get to work in my first post is wrong. Here is an inner page url:
    http://djxstation.com/wp/autodjpac/features/
    and the home url is now redirected to:
    http://djxstation.com/wp/autodjpac/home/

    Why is this third site not even showing the home page? I thought that was a separate issue from the domain mapping, because it worked for the other 2 sites ... so I'm confused now.

  8. I thought that was a separate issue from the domain mapping, because it worked for the other 2 sites ... so I'm confused now.

    Yes, it's a separate issue.

    Does a /public_html/wp/autodjpac/ folder happen to exist? That's basically the only reason it would show that index directory. If there is then you need to delete that folder. With WordPress Multisite you don't create new sub sites through adding folders like that, WP takes care of it automagically :)

  9. cindy c
    Member
    Posted 1 year ago #

    AutoMagically, wahoo! Thank you for finding the needle in that haystack, I could not figure out why it kept showing me that index directory. I found and deleted it, and now my home page displays, hooray!

    Thanks very, very much for that. At least I feel like I fixed *something* :)

    I will try to backup and then move the entire multisite tomorrow. Is there anything special about backing up a multisite install? I feel like I'll miss something. And, how easy is it to restore if I need to? I'm hoping for a bulletproof backup plan, if you know what I mean! And thanks so much for the extra folder find!

  10. Great :)

    I will try to backup and then move the entire multisite tomorrow. Is there anything special about backing up a multisite install?

    I see you're using cPanel. Here's probably the fastest way to make a backup.

    File Backup --> Log in to your cPanel account. Hit File Manager in the "Files" section. Check Web Root and hit GO. Find your way to /public_html. WP folder should be there. Right click on the folder and hit Compress. It'll do it's thing and create a .zip file. Once it's done hit reload. Download a copy of that to your computer and keep one copy of it somewhere outside the /public_html folder ( so others can't steal it).

    Database Backup --> Back to cPanel home screen. Hit Backups. On left side there should be a section labeled "Databases" and have download links of your databases. Click on the right now and save it somewhere safe on your computer.

    That should do it...

    And, how easy is it to restore if I need to?

    Leave the existing database on the server if you can. Add a fresh set of WP files and a new database for the new setup. If things go wrong you can just get rid of all those new files, unzip the backup zip file back to /public_html/wp/ you and bam, restored :)

  11. cindy c
    Member
    Posted 1 year ago #

    Find your way to /public_html. WP folder should be there.

    I just realized, my WP folder is in a subfolder within public_html. WP is installed in the subdirectory for one of the sites - the first one I created. So it's currently /public_html/domain.com/wp/
    Also, other websites on this hosting account have /wp installed in the respective site directories (v. 3.5.2). Although I won't be touching them, I am hoping they won't be affected by me installing 3.6.1 at the web root (actually /public_html root).

    Leave the existing database on the server if you can. Add a fresh set of WP files and a new database for the new setup.

    When you say "add a fresh set of files" - do I upload my WP files from [my backup/copy of the original install] to the new location? If I install new from the cpanel, I can't choose to install 3.6.1, I will get the current version (3.8). Pretty sure I don't want to mess with that at this stage... also, if I'm uploading my [backup/copy] 3.6.1, I'll be able to also upload my copy of the Quark template files. Of course some changes I made locally and uploaded via FTP, other times I used the WP template interface - will all of this be saved with the backups you described?

    Thank you so much for helping me and having patience while I cover all the bases! Happy New Year!

  12. So it's currently /public_html/domain.com/wp/

    You're correct :) I didn't take in to account that you may have it installed on an add-on domain. The few times I used cPanel a few years back I only installed multisite on the primary domain so /public_html/ instead of /public_html/domain.com. Either way it's still the root path of the domain so it should work...

    Also, other websites on this hosting account have /wp installed in the respective site directories (v. 3.5.2). Although I won't be touching them, I am hoping they won't be affected by me installing 3.6.1 at the web root (actually /public_html root).

    If the other websites have WordPress at some place like /public_html/otherdomain.com/wp/ then just leave those like they are. Won't impact you're end goal.

    But this Multisite was originally at /public_html/domain.com/wp/ you'll want to put it at /public_html/domain.com and not /public_html unless you changed the primary domain on your cPanel account.

    When you say "add a fresh set of files" - do I upload my WP files from [my backup/copy of the original install] to the new location?

    Yes, I misspoke - you definitely want to put your backup files there :)

  13. cindy c
    Member
    Posted 1 year ago #

    Thank you! I want to clarify one more thing about the location and main domain.

    But this Multisite was originally at /public_html/domain.com/wp/ you'll want to put it at /public_html/domain.com and not /public_html unless you changed the primary domain on your cPanel account.

    My potential glitch: I installed the multisite to /public_html/domain.com/wp. One of the sites that uses that multisite install ... is actually the main domain for the hosting account, and is thus located at /public_html/

    I see my error there ... that I took the root website and dragged it down 2 or 3 levels to access the multisite install of WP. Given THAT, do you think it will work if I load my backup files to the main domain root /public_html/ vs. /public_html/domain.com ? I would then be switching the WP install to the root of the primary domain on the cpanel account, so unsure if that site will still work without a huge move/effort. arg, how did I tangle this web so? here's the primary domain: partisound.com but you'll see I have it redirected to http://djxstation.com/wp/partisound/, which is really backwards and gnarly.
    I hope this is still my solution, what do you think??
    Thank you again for all of your time!

  14. I installed the multisite to /public_html/domain.com/wp. One of the sites that uses that multisite install ... is actually the main domain for the hosting account, and is thus located at /public_html/

    Yeah there's a glitch there. If you want to use the primary cPanel domain on the multisite then the installation needs to be directly in /public_html/. This is because you can't change the web document root of the main domain like you can with add-on domains.

    Given THAT, do you think it will work if I load my backup files to the main domain root /public_html/ vs. /public_html/domain.com ?

    Yup, you'll need to do that if you want to map the primary cPanel domain with the multisite installation. For the reason above ^^. Be sure to change the web document root for "domain.com" to /public_html/.

    Then start with the fun part! http://codex.wordpress.org/Moving_WordPress#Moving_WordPress_Multisite

  15. cindy c
    Member
    Posted 1 year ago #

    Cool! I'm uploading the WP files to the root now, and using the half-elf link you provided above. It's easier to understand than the codex.

    I had created a new database and user, but it looks like I move forward with the current database in place. I opened phpMyAdmin, realized I have no idea what I need to change, but with backups in hand, I'm going forward.
    Files I'm uploading include those for the primary domain (currently moved down 2 levels to access the WP install. These files are listed as wp-content/uploads/sites/3/...

    Do I need to move files from that directory to the /public_html/ directory because that's the root?

  16. Do I need to move files from that directory to the /public_html/ directory because that's the root?

    Nope. So they were initially at /public_html/domain.com/wp/wp-content/uploads/site/X..../ and they will now be /public_html/wp-content/uploads/site/X.../

  17. cindy c
    Member
    Posted 1 year ago #

    OK, I think I get that part. So I uploaded everything and removed my redirects.
    Regarding changes to the database: This is strictly a "pages" website - no comments, posts, trackbacks or anything.
    So I'm not changing anything in the database under wp_posts or wp_x_posts
    I found wp_blogs with 3 ids, and tried to change the domain and path for each. I also changed the wp_options siteurl to the appropriate value ...
    now all three sites have error establishing a database connection. so at least I got them to change, although I have no idea how to change the db connections. I'm still playing with it but totally unsure. Is there a step-by-step for changing values/tables/etc. in the database? I'm sorry to be so {seemingly incompetent} in the db arena - argh!

  18. cindy c
    Member
    Posted 1 year ago #

    Thank you so much for all of your help, Patrick.

    I didn't figure out how to move the install and get the sites to display (no db connection for any of them).

    For now I reverted back to the convoluted URLs of all 3 sites, because at least the sites display and won't be down in the morning.

    I may attempt again tomorrow but I'm really nervous about it. I suppose I could install single versions of WP in each top-level domain folder, so the urls would not have to go to Timbuktu and back. Do you think that would work and be simpler for someone not well-versed in databases?

    Thank you again, so much, for all of your help!!
    I hope you have a wonderful new year!

  19. (no db connection for any of them).

    That means the database user or password in wp-config.php weren't correct or the database is not on the server.

    I suppose I could install single versions of WP in each top-level domain folder, so the urls would not have to go to Timbuktu and back.

    You could do that but since you have an existing install I think it's easier to just move that rather than splitting it up into X parts.

  20. cindy c
    Member
    Posted 1 year ago #

    I would like to upload my backup WP to the new location, using a NEW database, so I don't mess up the current multisite installation. Is it possible to copy the install to a new database, and if so, is there a tutorial or step-by-step that details which files to modify? Since I already tried and got lost in the db files I'm a little hesitant to risk messing it up again.

    [Should start a new thread for this - I don't want to keep asking for help if you think it's a separate issue. thanks!]

  21. I would like to upload my backup WP to the new location, using a NEW database, so I don't mess up the current multisite installation.

    Sure, you can replicate the database. Go into phpMyAdmin and export the existing multisite database. Then go to cPanel and create a new database. Then go back to phpMyAdmin and import the exported file.

    It's kind of a lousy situation since you're dealing with live sites :(

  22. cindy c
    Member
    Posted 1 year ago #

    Great, thanks! I successfully replicated the database and imported it into my new db. I also successfully have interconnect/it search/replace script ready to go ... except I'm unsure exactly what to replace.
    I THINK I am replacing the domain.com urls with paths from /public_html/ and point to the new WP files at the root directory.

    Given the desired end result of replacing:
    http://djxstation.com/wp/autodjpac/ -->> autodjpac.com/
    http://djxstation.com/wp/ -->> djxstation.com/ (orig. WP multisite primary)
    http://djxstation.com/wp/partisound/ -->> partisound.com/ = ROOT/primary domain for hosting account = should become multisite primary somehow (do I change it to -->> /public_html/ ???

    Be sure to change the web document root for "domain.com" to /public_html/.

    I'm ready, just want to do it correctly! Thank you so much :)

  23. So just making sure here -- all you're doing right now is, for example, changing http://djxstation.com/wp/autodjpac/ to http://djxstation.com/autodjpac/. The domain mapping plugin will take care of the rest after this part is finished.

    For the part you're doing right now, moving from djxstation.com/wp/sitename to djxstation.com/sitename it doesn't matter what the document root is for the add-on domains, they're not being used. But yes, once you're ready to map the add-on domains they must all be pointed to /public_html.

  24. cindy c
    Member
    Posted 1 year ago #

    So just making sure here -- all you're doing right now is, for example, changing http://djxstation.com/wp/autodjpac/ to http://djxstation.com/autodjpac/.

    Actually it is http://djxstation.com/wp/autodjpac/ to http://partisound.com/autodjpac/, because djxstation is not main domain, partisound is. But I'm trying to use the interconnect/it tool, which I believe makes changes in the new database. I'm not sure if those urls are even included in the database files, or if I change them with the interconnect/it tool. I am trying to make the necessary changes to the database tables first. Then I was going to go to the domain mapping plugin.

    The only thing I know to change in the database is the connection in either .htaccess or wp-config.php file to use the new db / user / password. As for the tables ... even using the tutorial I'm not sure which to change. :(

  25. OK, yes that tool will make the changes for you. Do a dry run first to make sure the changes actually makes sense and then proceed.

    So these are the search and replaces to run...I think that's all you need.

    (1) search & replace "djxstation.com" to "partisound.com"
    (2) search & replace "/wp/sitename/" to "/sitename/"
    (3) Go to wp_blogs table and change the path from "/wp/" to "/" for Site ID 1.
    (4) Edit wp-config.php

    define('DOMAIN_CURRENT_SITE', 'partisound.com');
    define('PATH_CURRENT_SITE', '/');

    I think that covers all the changes but I could be forgetting something...

  26. cindy c
    Member
    Posted 1 year ago #

    Wow, this is great, I never knew a "dry run" could point out so many things to think about! For instance, the order in which I search/replace these things matters a LOT.
    If I do this one first:

    (1) search & replace "djxstation.com" to "partisound.com"

    then there will be no more djxstation.com to change - and that site (djxstation.com), which was site ID 1, will be pretty much gone, I think.

    here's what I've tried ... modified... to address that.
    {0} search & replace "djxstation.com/wp/partisound/" to "partisound.com/" **NEED TRAILING SLASH**

    {2} search & replace "/wp/sitename/" to "/sitename/"
    "/wp/autodjpac/" to "/autodjpac/"
    "/wp/partisound/" to "/partisound/" **NOT NECESSARY** taken care of in {0} NONE SHOULD EXIST
    {2.1} "djxstation.com/wp/" to "partisound.com/djxstation.com/" **NOT SURE ABOUT '.com' ? djxstation files should be the only ones left in /wp/ directory, so should I switch them to "partisound.com/djxstation/" ? I don't want to confuse subfolders with site ID here ...
    **Trying to keep djxstation from disappearing when I run {1} djxstation.com/ to partisound.com/**

    {1} search & replace "djxstation.com/" to "partisound.com/" **I SHOULD DO THIS NEARER THE END**

  27. cindy c
    Member
    Posted 1 year ago #

    Hi Patrick,
    I made the search/replaces that you outlined using Interconnect/it. Please ignore my previous post above (6 days ago) ...that was me overthinking everything, I think! I decided to go with your outline and keep it straight.
    Then I edited the wp-config.php as you said:

    So these are the search and replaces to run...I think that's all you need.

    (1) search & replace "djxstation.com" to "partisound.com"
    (2) search & replace "/wp/sitename/" to "/sitename/"
    (3) Go to wp_blogs table and change the path from "/wp/" to "/" for Site ID 1.
    (4) Edit wp-config.php
    define('DOMAIN_CURRENT_SITE', 'partisound.com');
    define('PATH_CURRENT_SITE', '/');

    Then I installed the wordpress-mu-domain-mapping.0.5.4.3 and started to follow those instructions. I "Network Activated" the plugin, and then when I got to step 4, I tried to get in to my WP network the usual way, I got this error:

    The domain mapping plugin only works if the site is installed in /. This is a limitation of how virtual servers work and is very difficult to work around.

    BUT ... Then I realized I was trying to get to the network admin of my current / live WP database/installation. This is the URL of the page with the error:
    http://djxstation.com/wp/partisound/wp-admin/post.php?post=33&action=edit
    So at present I am unable to edit my original 3 sites on the
    WP multisite install, but the sites are still working.

    When I try to go directly to the primary domain/root site to login to WP, I get this error:

    Internal Server Error

    The server encountered an internal error or misconfiguration and was unable to complete your request.

    Please contact the server administrator, webmaster@partisound.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

    More information about this error may be available in the server error log.

    Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

    I was worried that I missed something in the search/replace, but I'm pretty sure I uploaded the MU domain mapper plugin to the root and not to my /wp/ install area.

    Do you know what I might have done wrong? It seems I've messed up the old/stable/currently live install as well as not being able to work on the new one.

    Thank you, and please, and I really thought I was there!

  28. Do you have Multisite installed in the root of the primary network domain? Right now it looks like it's in /wp/.

  29. cindy c
    Member
    Posted 1 year ago #

    I have it in the primary domain root. Something keeps redirecting it into /wp/ and also connecting the MU Domain Mapper with the old WP installation, which is at /public_html/djxstation.com/wp/

    Also, in Dreamweaver my FTP connection to the primary root where I installed the *new* multisite WP is messed up. I didn't change anything in the server definitions, but after installing the domain mapper I can't connect. Is that related to changes I made?

  30. cindy c
    Member
    Posted 1 year ago #

    to clarify this:

    The domain mapping plugin only works if the site is installed in /. This is a limitation of how virtual servers work and is very difficult to work around.

    BUT ... Then I realized I was trying to get to the network admin of my current / live WP database/installation. This is the URL of the page with the error:
    http://djxstation.com/wp/partisound/wp-admin/post.php?post=33&action=edit
    So at present I am unable to edit my original 3 sites on the
    WP multisite install, but the sites are still working.

    This is the original install that's 3 directories down, not the one I copied and put up at the root.

Topic Closed

This topic has been closed to new replies.

About this Topic