WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Exclude folders from htaccess rewrite (3 posts)

  1. richbate
    Member
    Posted 3 years ago #

    Hello,

    I have a multisite set up here http://dmblogs.ncl.ac.uk/

    I'm migrating from an old set up where each student had
    home/username, within that they had /blog & /wiki.
    the new multisite set up is a dream to manage, but I'm having conflicts.

    eg I understand site.com/username is a re-direct. but it I need to have site.com/username/wiki as a real folder with a mediawiki install.

    I can get this to work, but obviously it breaks site.com/username

    Here's my htaccess

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]

    # uploaded files
    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

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

    Thanks in advance!

  2. Hmm.

    Well their blog will be domain.com/username, unless you set up each site to have a static home page, with the blog posts on /blog (which you CAN do).

    For the Wiki I'd cheat.

    Install it in /wiki/username and then toss this in to redirect /username/wiki/whatever to /wiki/username/whatever on the QT.

    RewriteRule ^(.*)/wiki/(.*)$ /wiki/$1/$2/      [L,NC]

    Mind you if they make a post 'wiki' it could screw things up.

  3. richbate
    Member
    Posted 3 years ago #

    Thanks very much,

    I had to tweak things a little, but your comment certainly put me on the right track.
    I had to exclude user/wiki from the rewrite set up in multisite, then direct to medwiki/user.

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    #exception added to allow user/wiki rewriterule
    RewriteCond %{REQUEST_URI} !^wiki
    # rewrite rule to get to /medwiki/user
    RewriteRule ^(.*)/wiki(.*)$ /medwiki/$1/$2 [L,NC]
    # uploaded files
    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]
    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]

    Thanks for your help, I'll be back soon!

Topic Closed

This topic has been closed to new replies.

About this Topic