The MU forums have moved to WordPress.org

Dropping /blogs/ bit of URL with subdomain / subdirectory install (9 posts)

  1. GameraFan
    Member
    Posted 17 years ago #

    First, I've got everything up-and-running with the 8/24 nightly build and am very, very impressed with the software. I can't wait to open it up to my users.

    One thing I'd like to change though is the requirement to have /blogs/ at the end of a user's blog (eg http://example.mysite.com/blogs/). Typing example.mysite.com brings me to my root's index page.

    Can someone point me in the proper direction to allow users to have their blog's URL as example.mysite.com or example.blogs.mysite.com?

    Setup:
    8/24 nightly build wordpress mu
    PHP v4.4.4
    Apache v2.2.3

    .htaccess file
    --------------
    RewriteEngine On
    RewriteBase /blogs/

    # Rewrite http://www.domain.com to domain.com
    RewriteCond %{HTTP_HOST} ^www\.(.*)
    RewriteRule ^(.*) http://%1/$1 [R,L]

    #uploaded files
    RewriteRule ^(.*)?/?files/(.*) 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 . index.php [L]

    Thanks in advance!

    RJ

  2. honewatson
    Member
    Posted 17 years ago #

    I'm not sure if this will work but...

    You could try changing the following lines in wp-admin/options-permalink.php

    68 $permalink_structure = '/blog' . $permalink_structure;

    to

    68 $permalink_structure = '/' . $permalink_structure;

    --------------------------------------------

    78 $category_base = '/blog' . $category_base;

    to

    78 $category_base = '/' . $category_base;

    Also on lines 157 and 166 there are a total of 4 more '/blog' to change to '/'

    ...but that is just for the display on the admin panel.

  3. drmike
    Member
    Posted 17 years ago #

    I think it's going to have to be changes elsewhere as well within the code. I seem to remember a few places it was at.

  4. pumpkinslayer
    Member
    Posted 17 years ago #

    I would try this way...

    Make a real subdirectory blogs.domain.com (I have cpanel on my shared hosting and would do it that way)

    Change the wildcard / catchall settings appropriately.

    Install straight into the blogs.domain.com subdirectory.

    Domains would look like virtualsubdir.blogs.domain.com

    Too simple? Did I miss something? This way you wouldn't have to change any code either.

  5. GameraFan
    Member
    Posted 17 years ago #

    Thanks for the suggestions! I'd rather not change the code itself and will try pumpkinslayer's idea. I will post back in this thread whether I'm successful or not.

  6. GameraFan
    Member
    Posted 17 years ago #

    I can get the blog set-up using blogs.domain.com but when I try to create a second blog the virtualsubdir.blogs.domain.com is going to my main page.

    The wildcard DNS I have is *.blogs.domain.com and I've added the following to my Apache config:

    <VirtualHost xx.xx.xx.xx:80>
    ServerName blogs.domain.com
    ServerAlias *.blogs.domain.com
    DocumentRoot /home/domain/www/blogs
    <Directory "/home/domain/www/blogs">
    Options Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
    </Directory>
    </VirtualHost>

    The .htaccess file:

    RewriteEngine On
    RewriteBase /

    # Rewrite http://www.domain.com to domain.com
    RewriteCond %{HTTP_HOST} ^www\.(.*)
    RewriteRule ^(.*) http://%1/$1 [R,L]

    #uploaded files
    RewriteRule ^(.*)?/?files/(.*) 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 . index.php [L]

    Any thoughts on why virtualsubdir.blogs.domain.com isn't working?

    Thanks in advance.

  7. pumpkinslayer
    Member
    Posted 17 years ago #

    I'll just tell you what I asked my host to do when I needed this done... (changed to fit your request, I assume it will work)

    *.subdomain.domain.com. 14400 IN A 00.000.00.00

    in the DNS. And...

    ServerAlias *.subdomain.domain.com

    in the Apache virtual hosts directive (looks like you've done this one already)

    There should be no need to mess around with the .htaccess

  8. GameraFan
    Member
    Posted 17 years ago #

    Not working. Not sure why. The sub-subdomain is returning my main page.

    I guess I'll have to go with the subdirectory install instead. Thanks for trying.

  9. basketcase
    Member
    Posted 17 years ago #

    GameraFan,
    I seem to be having the same problem as yourself, having configured DNS per the readme.txt file and making all the necessary changes to my vhost.conf file and such.

    I was able to get the subdirectory installation to work great though!

About this Topic

  • Started 17 years ago by GameraFan
  • Latest reply from basketcase