Support » Networking WordPress » How do rewrite rules work with multisite?

  • How does wordpress know which site it is on, given the URL.

    So, I remember from earlier versions, you could rewrite the url
    index.php/34 to index.php?p=34

    Is there an equivalent for each site?

    E.g.
    example.com/site1/post-1
    becomes
    example.com/index.php?site=site1&post=post-1

    Is this the case?

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

    (@ipstenu)

    Lead Plugin Wrangler

    No, it’s this:

    example.com/site1/post-1 == example.com/site1/index.php?p=34
    example.com/site2/post-1 == example.com/site2/index.php?p=34

    There is no in-between bit where it would translate the site number. How does it do that? Something VERY smart on the back end I gather.

    Andrea Rennick

    (@andrea_r)

    Customer Care at Copyblogger Media and Studiopress

    Via the rewrite rules, it looks up the request in the database & serves it directly.

    So how does it serve the admin areas for the cities? It looks like it rewrites it back to the default admin location /wp-admin/whatever. How does the admin area know which city is being requested?

    Andrea Rennick

    (@andrea_r)

    Customer Care at Copyblogger Media and Studiopress

    How does the admin area know which city is being requested?

    It looks it up in the db based in the request coming in. That’s why the full URL is stored in there.

    Is this a theoretical question, or are you trying to do something specific?

    Ron Rennick

    (@wpmuguru)

    MultiSite Guru

    It doesn’t do /wp-admin/whatever, it does /whatever/wp-admin.

    Andrea_r: it was a little of both. I was trying to get rewrites working on an IIS server with ISAPI_rewrite by Helicon. Wanted to know if I had to hack the WordPress core to get it working, but it turns out I just needed to change the RewriteRules because the syntax is a little different.

    Thanks for your help though!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How do rewrite rules work with multisite?’ is closed to new replies.