The MU forums have moved to WordPress.org

Subdomain and .htaccess (10 posts)

  1. Nepherim
    Member
    Posted 17 years ago #

    I've never used WP before, but getting RC4 up and running was pretty smooth, and everything is up and running.

    I installed in a sub-directory under the root "/wp". Thus blogs are accessed via "user.domain.com/wp". Works great.

    I'm trying to get .htaccess to rewrite url's so blogs are accessed via "user.domain.com" (no "/wp").

    I'm using the htaccess.dist with no modifications as a start point.

    1] What change needs to be made to WPMU so it does not use "/wp" in generated URL's?
    2] How would I change .htaccess to accomodate this? I think something like this:
    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/wp-content/blogs.php?file=$2 [L]

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

  2. amanzi
    Member
    Posted 17 years ago #

    Is there a reason why you are installing WPMU into a folder called /wp? The best solution would be to install the files into your webserver's root and then users would access the blogs like this: "user.domain.com"

  3. Nepherim
    Member
    Posted 17 years ago #

    I'm going to be installing other s/w associated with that domain, and so rather than cluttering root, I'd like to keep things separated into sub-dirs.

    I know .htaccess can accomodate this, and I'm pretty sure WPMU would have a setting to use 'clean' urls.

  4. kahless
    Member
    Posted 17 years ago #

    Can't you salvage the situation by changing the DocumentRoot in the Apache vhost definition to be /path/to/wp? I have my WPMU in a folder called wpmu inside the root and defined the vhost DocumentRoot to be /path/to/wpmu and blogs are accessed as username.domain.com.

  5. Nepherim
    Member
    Posted 17 years ago #

    Setting DocumentRoot would likely work, but unfortunately I don't have direct access to httpd.conf. It's likely my hosting provider would add it for me -- afterall they added the wildcard in there, but every change will require a support ticket.

    What I loose with this approach is flexibility; I'm going to be installing additional s/w under this domain, so not everything will be redirected to /wp.

  6. Nepherim
    Member
    Posted 17 years ago #

    No-one taken the .htaccess route (and I suspect some WP clean URL setting) to solving this problem?

  7. Nepherim
    Member
    Posted 17 years ago #

    Having received no answer, and being unable to find an answer, or make it work myself, I tried Lyceum. Took me a total of 30 minutes to install and work out how to achieve totally clean URLs with Lyceum installed in a sub-directory. I needed to do no research -- it was all documented.

    So far, I'd have to say I highly recommend Lyceum over MU.

  8. al_bondi_2000
    Member
    Posted 17 years ago #

    Nepherim: Thank you for your post, I have tried the same thing with WPMU and I have the same situation you have on your server, since WP is not the only software that will be running on my server and have not received any answers about this issue. I will be checking Lyceum and hopefully works for me as well.

  9. mickemus
    Member
    Posted 17 years ago #

    Well... it is clearly stated that you need to be prepared to get down and dirty to work with wpmu in it's current state...! We're all beta testers at this time!

    I recommend you type up your suggested feature enhancement and post it in the Features & Requests forum. It may very make it into the final 1.0 release!

  10. touma
    Member
    Posted 17 years ago #

    Hey guys, first post!

    Try this:

    -----------------------------------
    RewriteEngine On
    RewriteBase /

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

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

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

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

    I also removed the [R] condition in line RewriteRule ^(.*) http://%1/wp/$1 [L] so if you write domain.com, it doesn't redirect (forced) to domain.com/wp/.

    I hope it helps...

    Marcel Touma

About this Topic