• Resolved richbate

    (@richbate)


    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!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    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.

    Thread Starter richbate

    (@richbate)

    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!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Exclude folders from htaccess rewrite’ is closed to new replies.