The MU forums have moved to WordPress.org

Change main blog from /blog to root? (29 posts)

  1. MotaBoi
    Member
    Posted 15 years ago #

    I just installed WPMU but my main blog is located at the subdirectory domain.com/blog. I want it to be located and its posts being shown at /, how can I do that? I've searched the forums throroughly and the only recommendation I have found is to change the permalink address in the 'permalink_structure' value in the database. I have done so, and the only thing it changes is the links. I discovered some occurrences of the "blog" word at 'rewrite_rules' and removed them, but it still does not work. Any ideas?

    Thanks...

  2. Ovidiu
    Member
    Posted 15 years ago #

    I got rid of this by using a plugin that redirects mydomain.com/blog/ to mydomain.com and it works beautiful.

  3. MotaBoi
    Member
    Posted 15 years ago #

    Wow, care to elaborate? A name perhaps? It would be greatly appreciated.

  4. Ovidiu
    Member
    Posted 15 years ago #

    there are severall redirect managers, but here is the one I prefer: http://www.urbangiraffe.com/plugins/redirection/

  5. anahowa
    Member
    Posted 15 years ago #

    how did you fix this with redirection plugin ?

  6. Ovidiu
    Member
    Posted 15 years ago #

    make a redirect from maindomain.com/blog to maindomain.com :-)

  7. wpvince
    Member
    Posted 15 years ago #

    I haven't installed WPMU yet, but was planning to use a subdirectory for deveopment and then move to root.

    If I understand the above posts correctly, are you all saying that this is would not be a simple change in the main config file - something like PATH=rooturl?

  8. lunabyte
    Member
    Posted 15 years ago #

    Vince,
    what I get of this is that the OP is either talking about the way the category links are created, or they literally installed MU in a subdirectory called blogs.

    Assuming the first scenario, by default MU adds "/blog/category" to all category links. It's similar to how the standard version of WP adds "/category" to all the category links, if you are familiar with that. It's through the list_cats, or wp_list_cats functions where this additional information is being added.

    As I mentioned in another post, I'm not sure why this is so, but there must be some reasoning behind it. I can only guess at it.

    If you look at the permalinks settings for an individual blog, you will see at the bottom it talks about "/taxonomy/tags", and the category base. This is what I think the OP is talking about.

    I want to say IIRC that there was a problem with pages and categories clashing with permalinks in the standard WP version, which is why post cats all are linked to as /category/whatever.

    I did read on the main WP forums a fix that does a preg replace or something of that nature in one of the core files, which removes the "/category" from the url generated by list_cats/wp_list_cats. I've tried that out on a standard WP install, and it works fine without any problems. However, my guess is when there is a match between a page slug and a post slug that the conflict exists.

    So if you had a page that had a slug of "portfolio", for example, and then made a post category called "portfolio", if you go to yoursite.tld/portfolio/, the software doesn't have a clue what to bring up. Does it render the page or category?

    So, my best guess is that with /category (or /blog/category in MU's case) is being added to prevent the possibility of the above referenced type of collision.

    You may have noticed that the actual permalink to the post itself doesn't have this in there.

    IMHO, requiring the slug to be unique regardless of page or category, would correct the issue. Running a check when adding a new page or category against the other's slugs, would most likely work. If you're adding a page, check category slugs, or if you're adding a category, check the page slugs.

    While I'm sure the majority of people are bright enough to not add a page and a category with the same slug, with something on the scale of WP and WPMU, the dev's have to build it as idiot proof as possible. So, I can understand the err for caution.

    Although for MU, instead of making /category into /blog/category, personally just /blog would be fine for me.

    Or, I could be out in left field, but that seems to be the underlying issue.

  9. wpvince
    Member
    Posted 15 years ago #

    Hi lunabyte,
    thanks for the detailed post regarding scenario 1.

    Any chance you also know the answer to my particular question on deveoping within a subdirectory, and then moving to root please?
    Is it a simple change in the main config file?

    Many thanks

  10. lunabyte
    Member
    Posted 15 years ago #

    It wouldn't be an easy process. Depending on how many blogs were on there at the time, the more there were the bigger hassle it would be.

    Is it for an active domain, that already exists? If not, why not just lock down the main directory with .htaccess and use a username/pw for a while?

    I mean, you can do it in a sub directory, and then go change some things, but it really isn't for the faint of heart to try and do.

  11. anahowa
    Member
    Posted 15 years ago #

    how to make a redirect from maindomain.com/blog to maindomain.com ???

  12. lunabyte
    Member
    Posted 15 years ago #

    Did you install MU in a subdirectory called blogs?

    If you did, you can't.

    If not, and you're talking about the links that wp_list_cats or list_cats, then there's hope with the above plugin.

  13. tgp
    Member
    Posted 15 years ago #

    I have mu installed on a subdomain blogs.site.com the files are located in /blogs anyway for me to get rid of it from adding /blog to the URI? I tried removing every instance of /blog from the options-permalinks file in wp-admin and redoing the permalinks but still didn't work mu tried to create a blog using the first permalink field which was the year so it kept using 2007. Any advice aside from the redirect plugin?

    Thanks

  14. MrBrian
    Member
    Posted 14 years ago #

    I'de like to know how to do the opposite? I'm having such trouble just getting /blog to be my page with posts and such. It doesn't do this by default, and the theme im using is custom made. Please, i'm dying for help.

  15. andrea_r
    Moderator
    Posted 14 years ago #

    Why not make a custom page template called "blog" and get it to pull in your latest main blog entire son to that?

    Otherwise, i can't see what it has to do specifically with a custom made theme.

  16. MrBrian
    Member
    Posted 14 years ago #

    I've tried that and what happens is the page turns into a "page". Such as the first post is the name of the page "blog", so it's not displaying correctly. I saw the same problem in another thread but he had not solved it, someone said it had to do with "Template Heirarchy".

  17. andrea_r
    Moderator
    Posted 14 years ago #

    http://codex.wordpress.org/Template_Hierarchy

    That may help. I know what you want can be done.

  18. reggordon
    Member
    Posted 14 years ago #

    im sorry if im stupid biut i can't find this answer and if i could i probably wouldnt even recognise it. Go easy on me please folks. I think im in the right thread.

    I have my wpmu on http://www.mydomain.com/blogs/

    i want it on my root http://www.mydomain.com

    Is this possible and what would i need to do?

    Any links or advice appreciated. Even just to know if it's possible wold be great as if not then i wont worry about it anymore.

    thanks

  19. reggordon
    Member
    Posted 14 years ago #

    ps the reason im worried about that redirect thingy is that the reason i want to move it is because i want my memebers to have a nicer url http://www.amember.mydomain.com instead of http://www.amember.mydomain.com/blogs/

    As long as i can offer the shorted url to my users that would do me. I thought this thread was the answer but i dont know if we're ll talking about the same thing anyore. Sorry for looking for an answer to my question.

  20. andrea_r
    Moderator
    Posted 14 years ago #

    Yeah, you've changed your question. :) Honestly, if you want cleaner URLs for your users, why not just install MU in the root folder?

    Although... from your above info, I thought it *was* in the root, and just the main blog had "blog" in the URL.

  21. hpmathieu
    Member
    Posted 14 years ago #

    You might try to put the following in your .htaccess file at the DocumentRoot level of your site '/'(if your wpmu is installed in /blog:

    <
    Options +FollowSymLinks
    RewriteEngine On
    RewriteBase /

    #uploaded files
    RewriteRule ^(.*/)?files/$ /blog/index.php [L]
    RewriteRule ^(.*/)?files/(.*) /blog/wp-content/blogs.php?file=$2 [L]

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule . - [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-.*) $2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . /blog/index.php [L]

    >
    May be subject to improvement by expert.
    Change blog by the name of your WPMU folder accordingly if it's a different name.
    It worked for my WPMU install in a subdir people get to their blog by the shorter url, anyway the the longer urls are displayed when clicking blog links but it's transparent ...
    Enjoy ... (hope it works for you).

  22. Anonymous
    Unregistered
    Posted 14 years ago #

    This sounds similar to what you want to do. The only difference is you already have your files in a subdirectory.

    http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory

  23. lunabyte
    Member
    Posted 14 years ago #

    Um, yeah, that codex page isn't applicable to MU.

  24. mlanglois
    Member
    Posted 14 years ago #

    Here is what I did:

    1. Create the following .htaccess in your root directory:
    ##########
    Options +FollowSymLinks
    RewriteEngine On
    RewriteBase /

    #redirects / to /blog/
    RewriteRule / /blog/

    #redirects to wpmu unless existing file or directory
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule (.*) /blog/$1
    ###########

    What it does is simple: if the URL requested does not correspond to a real file or directory, it simply moves it to /blog. This allows you to have /otherdirectory but be careful that no permalink will correspond to an actual file or directory!

    2. Edit your wp-config.php in wpmu base directory. Change $base='/blog/' to $base=''. From now on, all new blogs will point to the root directory.

    3. Existing blogs still point to /blog/; this is not a problem in itself (they will be correctly handled by wpmu), but you may change them too. You can do it manually in the Site Admin interface: select each blog one by one and change its path from "/blog/" to "/". You can also do it at once by accessing the MySQL tables directly.

  25. mlanglois
    Member
    Posted 14 years ago #

    Oops, my .htaccess doesn't work. Here is a corrected version:
    ##############
    Options +FollowSymLinks
    RewriteEngine On
    RewriteBase /

    #redirects to default site if not an existing file or directory
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule (.*) blog/$1 [L]

    #don't redirect if existing file or directory
    RewriteRule (.+) - [L]

    #last option: redirect to default site home page
    RewriteRule (.*) blog/
    ##############

  26. mlanglois
    Member
    Posted 14 years ago #

    There are some problems with file upload manager, so you also need to change upload dirs in your blogs.
    Overall I would suggest to use the multi-site manager which makes it easier to change those settings.

  27. gulflee
    Member
    Posted 13 years ago #

    i have my blog in
    domain.com/blog
    user in
    user.domain.com/blog

    it success on the redirect to user.domain.com

    but when it goes to user.domain.com/wp-admin then it cannot login to the admin.

    http://test2.domain.com/wp-login.php?redirect_to=%2Fwp-admin%2F
    can help??? please

  28. thai916
    Member
    Posted 13 years ago #

    I am looking for the same solution but not able to find out. I tried mlanglois solution but the problem is that my main domain http://www.mydomain.com also gets directed to http://www.mydomain.com/blog and also when i type http://www.mydomain.com/username it takes me to http://www.mydomain.com/blog

    i have joomla installed on the main site but want to use wordpress-MU for blogs. my wordpressmu installation is in http://www.mydomain.com/blog I only want my users to have cleaner urls so that it's easy to remember and they can distribute it to their friends..

    Please Can anyone help??

  29. lunabyte
    Member
    Posted 13 years ago #

    In a situation like that, the easiest way would be to install MU on a subdomain, like blogs.mydomain.com, and then use subdirectories off of that (blogs.mydomain.com/username).

About this Topic

  • Started 15 years ago by MotaBoi
  • Latest reply from lunabyte