WordPress.org

Ready to get started?Download WordPress

Forums

Having your weblog outside the WordPress directory (10 posts)

  1. MarkWubben
    Member
    Posted 10 years ago #

    I installed the latest CVS today, wanting to get some work done on my site. I've installed WordPress in a /wordpress directory, to keep the root clean. Putting the index.php file in / works perfectly well, but you can't point the site url to this location, because the admin part will fall apart (well, sort of).
    Anyway, to get to the point, using a little hack you can keep both things working:
    <pre>if(!preg_match("/.*wordpress\/wp-admin.*/", $_SERVER['REQUEST_URI'])){
    $siteurl = preg_replace("/(.*)\/wordpress(.*)/", "$1$2", $siteurl);
    }</pre>
    This will remove the /wordpress part of the site url, when you are not in the admin directory. If you are, the site url remains intact. In my code, replace wordpress by the directory in which you installed it.
    This hack must be placed in wp-includes/wp-db.php on line 44 (right after $siteurl = preg_replace('|/+$|', '', $siteurl);
    By the way, it would be a nice feature to specify a installation URI and a weblog URI (what this hack takes care of now).

  2. BAKSHI
    Member
    Posted 10 years ago #

    thanks! :)

  3. Jaykul
    Member
    Posted 10 years ago #

    Seems like you'd want to put the comments page (and any other pages that the public would be viewing, like your rss feeds etc) outside that wordpress directory ... but that's just me.

  4. Anonymous
    Unregistered
    Posted 10 years ago #

    I don't have any file hacks, and have my blog in a seperate directory than the index file. Everything works fine. All you have to do is change the includes. Then again, the includes have been changed for 1.0, so I don't know if that changes anything or not.

  5. MarkWubben
    Member
    Posted 10 years ago #

    Jaykul: I'll be using mod_rewrite anyway, so there is no real reason for me to move these files. If you are pointing to them directly, however, it is a good idea.
    Anonymous: If you change the include, you also hack the files.

  6. JoshuaClinard
    Member
    Posted 10 years ago #

    Nope. Not hacking any files. Just a template modification. Although I would like some clear instructions on how to do this in the documentation. Maybe I'll head on over to wiki and try to write some up myself. I could probably figure it out if I did some research.

  7. JoshuaClinard
    Member
    Posted 10 years ago #

    Can a developer please comment on this? I think a lot of us would REALLY like this feature in WP. I cannot get my archives or comments to work with 1.0. I am not willing to do a lot of hacking either, to get this to work. Just build in a feature that would let us specify a directory for the installation, and a directory for the index file. PLEASE!

  8. Alex King
    Member
    Posted 10 years ago #

    Joshua - My opinion: I'm sure it will happen at some point, but there are other features that are higher priority than re-writing something that already works for the sake of moving files around.

  9. JoshuaClinard
    Member
    Posted 10 years ago #

    Thanks for the reply. Hopefully it will happen soon.

  10. Anonymous
    Unregistered
    Posted 10 years ago #

    With the new version of wordpress, where do you place the code in wp-includes/wp-db.php, there is no (right after $siteurl = preg_replace('|/+$|', '', $siteurl); on line 44 expect </div>");. Any help would be welcomed.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.