• thepete

    (@thepete)


    I set up WP in a subdirectory of my site for testing and formatting purposes. I’d now like to move the main index.php file to the root directory on my server. I changed the URI in my “options,” but when I point the browser at the index.php file in the root directory, I get a bunch of PHP errors. I’m sure I’m doing something obvious that is screwing things up, only I don’t know what it is. Any ideas? Thanks in advance!

Viewing 15 replies - 1 through 15 (of 26 total)
  • shep

    (@shep)

    why not just keep it in that directory? you can always create an index.html that automatically points the user to the index in that direcotry. simple java can do it.
    post up a link

    Anton

    (@anton)

    I used a php forward on my site, like this:

    <?php
    /**
    * Place in a blank PHP page
    */
    // Change to the URL you want to redirect to
    $URL="https://www.spine-arrest.net/blog/index.php";
    header ("Location: $URL");
    ?>

    It’s possible to pull the index out, but you don’t really need to.

    shadow

    (@shadow)

    Another option is to have a simple welcome/redirection page.
    I found this useful after I started to build a few sites in different subdomains.
    Here’s an example
    https://www.os42.com which redirects to
    https://fools.os42.com
    https://shadows.os42.com
    https://te.os42.com
    Once people are aware of the redirections they often bypass the front page and go directly to the whichever site they prefer. IMO, it’s simple and effective ??

    idowens

    (@idowens)

    thepete, there is also a way to do this very effectively without having a redirect….When I initially installed WP it was into a subdirectory, and I was having to redirect via a Temp. Redirect script (which constantly filled up my server log and was annoying…plus it showed up at https://www.idowens.com/wordpress/ in the URL bar in the browser instead of just https://www.idowens.com). To make the permanant change, copy your index.php from the subdirectory it is currently in, into your server’s root. Then edit it changing the top line from
    <?php /* Don't remove this line. */ require('./wp-blog-header.php'); ?>
    to
    <?php /* Don't remove this line. */ require('./subdirectory/wp-blog-header.php'); ?>
    Then go to WP admin, Options, and change Blog URI to https://www.you.com/subdirectory/
    Finally, upload your new index.php to your root directory (making sure that ‘WordPress address’ still points to your subdirectory that has WP installed to it) and that should do it…let me know if you reach any errors.
    (Basically, this loads the index from your root (allowing you to not fool w/ redirects) and tells the index to pull the information it needs from the subfolder, not root).

    Changes .. have you hard-refreshed the page ?
    It won’t be a permissions error or it would not allow the change in the first place.

    Moderator James Huff

    (@macmanx)

    Well, it’s not that it’s “too” long. There’s just a lot of images and content. It takes 2 minutes to completely load on a 56k. And contrary to popular belief, only 45% of the computers in the world have physical access to broadband (note, that’s only physical access, it doesn’t mean that they use it).

    Thread Starter thepete

    (@thepete)

    Podz, I’ve tried emptying the browser chache, if that’s what you mean. I’ve never heard the phrase “hard-refresh.” You’re right about the permissions, although I tried it just to be safe. No go. Can’t think of anything else aside from maybe it’s still writing to the index.php in the WP directory. I just tested this theory by changing the name of the index.php file in the WP dir. Suddenly, when I saved index.php in the template section, it said the file did not exist. I checked in Options>General to make sure the Blog Address URI was accurate and it was–still pointing at https://thepete.com–that should be enough, right? I even tried changing that to https://thepete.com/index.php and that didn’t help.
    For now, I suppose, I could just transfer the index.php file out of the WP directory into my root whenever I change the template. Of course, that is a bit of a pain, so if there is a solution, I’d love to find it. Thanks again for the help!
    Oh and macmanx, I understand what you’re saying, I was just giving you a little ribbing. I’m just a hardcore blogger and have worked really hard to figure out a way to include everything on my main page that I felt I needed to. Believe it or not, I cut a lot of stuff out. But, c’est la web, I guess. When I was still using Grey Matter I had worked out an easy way to do a low bandwidth version of my site, but with WP, I haven’t figured out how to do it just yet. I figure I want to get the full bandwidth version working first. But I do appreciate your advice.

    Hard – or forced – refresh.
    Press CTRL and F5 to force a complete reload.

    Thread Starter thepete

    (@thepete)

    Well, I’m on a Mac, so I hit command+R to do that and still no go. Also, the post changed just fine when I refreshed, but the template elements remained the same. I did end up moving the index.php file into my root and now the changes are visible. For some reason WP isn’t writing the template changes to the correct index.php.
    I even tried telling it to pull up “./index.php” and editing that, but it still makes the changes in the incorrect directory.

    “For some reason WP isn’t writing the template changes to the correct index.php”
    This is exactly what has been happening with me. Only workaround at present is to recopy and edit the index.php from the WordPress directory to my root directory after each post. Not good!
    Is this a bug? As you have the option to specify a different Blog URI, shouldn’t the template editor know which file it should be using?

    macmanx – I know I could use a redirect – that’s not the issue.
    The WordPress options page allows you to set the Blog URI to a different location from your WordPress install. If it allows you to do that, then I would expect it to handle the location and editing of the template correctly. It isn’t.
    I THINK this is a bug and will check this today.
    Ohh and of course, it may be PEBCAK as I’ve only just switched to WordPress (yesterday).
    Anyone else got any ideas?

    Thread Starter thepete

    (@thepete)

    It sure seems like a bug to me, too–why have the option to keep your index.php in another location if you can’t edit it there? I’m always tweaking my site and while I thought I could deal, it’s gotten to be a serious pain. Any solution to this would be muchly appreciated.

    I took a look at this today. It’s gonna be hard to change because the template editor strips out anything but the filename. Its written to protect against writing outside of the WP directory, for security purposes. I’ll keep working on it though.

    Seemingly this has been fixed for 1.3 so I guess it’s a case of “hang in there” until 1.3 is released.
    I’m trying to get a definitive list of 1.3 fixes but it’s proving tricky!

Viewing 15 replies - 1 through 15 (of 26 total)
  • The topic ‘index.php outside of WP directory?’ is closed to new replies.