WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] URL problem after upgrade on virtual host (13 posts)

  1. byorgey
    Member
    Posted 6 years ago #

    I just tried to upgrade from 2.0 to 2.3. My blog is http://www.mathlesstraveled.com. It is being hosted (via an apache virtual host) at wso.williams.edu/~byorgey/wordpress/. Since it's a virtual-hosted domain, however, it should still appear as http://www.mathlesstraveled.com in the browser. This worked fine before the upgrade.

    The upgrade seemed to go smoothly and the upgrade.php script reported that the database was upgraded successfully. However, now when I visit http://www.mathlesstraveled.com, it tries to redirect to http://www.mathlesstraveled.com/%7Ebyorgey/wordpress/. This is obviously not correct and gives a file not found error. (I presume that 7E is the hex code for a tilde character.) Both the siteurl and home options in the database are set to http://www.mathlesstraveled.com/. Any help in figuring out where the spurious ~byorgey/wordpress is coming from and how to fix it is greatly appreciated.

  2. byorgey
    Member
    Posted 6 years ago #

    After much struggling I was able to get it fixed; everything seems to be working well now but I'm not sure if I fixed it in the "right" way! =)

    It turns out there were two problems. First, the server was reporting the REQUEST_URI strangely. I've had this problem before, and fixed it, but for some reason something changed slightly so I had to re-fix it. Essentially I had to edit wp-settings.php so that it deleted /~byorgey/wordpress/ from the REQUEST_URI. Once I fixed that, it got stuck in an infinite redirect... http://www.mathlesstraveled.com redirected to http://www.mathlesstraveled.com, which redirected to... and so on. I finally was able to fix this by commenting out the line

    do_action('template_redirect');

    in wp-includes/template_loader.php. I have no idea what this line is supposed to do, so I don't know if commenting it out is a good idea (I found it by grepping the entire source tree for 'redirect'), but it seemed to fix things, so...

  3. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    Instead of doing that, try adding this to your theme's functions.php:
    remove_action('template_redirect', 'redirect_canonical');

    That new code causes a redirect to what WordPress thinks should be the "correct" url for any given page on the site. This line will disable it.

    Problem with redirect_canonical is that it absolutely relies on $_SERVER['REQUEST_URI'] being correct, so if you're doing something weird to it, then it may not end up right.

    What is your code to correct the /~byorgey/wordpress/ problem? That may be slightly off which is triggering the problem.

  4. tapirul
    Member
    Posted 6 years ago #

    I have a similar problem and I tried to find an answer with no success; the next/previous links introduce a duplicated domain in the link. It seems that byorgey got to the core of the problem. I tried to follow his/her suggestion but with no success - I do not know what to edit in wp-settings file.
    I'd appreciate any help. I can post/send the content of my wp-settings file if needed. Thanks
    tapirul@gmail.com

    PS my blog is at http://oregonstate.edu/~dogaruc/tapirul

  5. moshu
    Member
    Posted 6 years ago #

    Why not just follow Otto's instructions? Instead of messing around with the core files (which means headache at every upgrade!) - just make a simple text file and put in it what Otto posted:
    <?php remove_action('template_redirect', 'redirect_canonical'); ?>
    then save the file as functions.php into the theme folder.
    Note, if you have a functions.php in your theme(s), just add the line above to it.

  6. tapirul
    Member
    Posted 6 years ago #

    that would have been my next question :-)
    I do have functions.php files in my theme folder, I was going to ask where should I add the line, at the beginning, at the end, etc.

    PS Any hint on the other problem, in the admin panel (comments section) clicking on "next comments" send me back to the admin panel?

  7. moshu
    Member
    Posted 6 years ago #

    Anywhere. To the end. Just make sure you will NOT have an empty line or space after the last closing ?> - it would throw in a lot of errors.

    One step at a time... you already hijacked this "solved" topic, so let's not go into other issues in it.

  8. tapirul
    Member
    Posted 6 years ago #

    doesn't do the trick...

  9. moshu
    Member
    Posted 6 years ago #

    Hmmm... I am sure the issue is that tilde [~] in your URL and the new way how WP 2.3 treats the permalinks.

    Unfortunately, I am not a coder as Otto is, so I don't have any suggestions.
    Let's hope he will come around.

  10. tapirul
    Member
    Posted 6 years ago #

    I cannot change the tilde unfortunately, this is how I access my space on the university's server. Looks like byorgey fixed it the hard way, though, and he has a tilde as well
    I tried changing permalinks back and forth, too.

  11. tapirul
    Member
    Posted 6 years ago #

    si ma intrebai ce am...
    I've switched to b2evolution, they have a converter, better customer support and better features.

  12. DouglasVB
    Member
    Posted 6 years ago #

    hey tapirul, i've been having the same problem on the same server (oregonstate). did you ever figure out how to resolve it?

  13. tapirul
    Member
    Posted 6 years ago #

    yes i did
    I moved to http://www.bluehost.com :-)

Topic Closed

This topic has been closed to new replies.

About this Topic