WordPress.org

Ready to get started?Download WordPress

Forums

Another multisite rewrite question (but other way around) (5 posts)

  1. markotitel
    Member
    Posted 11 months ago #

    Hello this is my first wordpress post.

    I work as junior system admin and I am not good php coder, although this question is about htaccess where I am not good either :).

    We have 54 multisite setup, and my boss wants me to setup some rewrite for one subdomain. Here is how it should work (if possibile at all).

    We have products.domain.com , and I have to rewrite that url so it shows in web address bar like http://www.domain.com/products. Subfolder products doesnt exist just need to rewrite path in browser.
    Also when I type http://www.domain.com/products it should stay that way but show the contents of products.domain.com.

    Huh this is imho really tricky to do.

    Is this possibile at all?

    Thank you very much.

  2. TheHandOfCod
    Member
    Posted 11 months ago #

    In my (limited) experience of modifying htaccess files I have found it can be a bit of a black art to get the re-write rules correct. It might be worth taking a look at the WordPress WP Rewite API first to see if this meets your needs.

  3. markotitel
    Member
    Posted 11 months ago #

    I see, that seems like very advanced area for me currently. I thought there were some methods that are already known for these kind of "wishes" :) thank you

  4. jkhongusc
    Member
    Posted 11 months ago #

    I do not think this is possible, it depends on your setup. The reason is that WP is using (mostly) virtual files/folders. Did you setup WP as subdomain or subdirectory? My guess is subdomain from your questions.

    So your main site is http://www.domain.com/ and http://www.domain.com/products would be a page from your main site.

    Now you are asking to rewrite http://products.domain.com/ to http://www.domain.com/products. Will you need to rewrite pages too, e.g. http://products.domain.com/page? Even if you modified your .htaccess file to change the url from subdomain.domain.com to 'http://www.domain.com/subdomain', WP will return a 404 error (not found). Those pages do not exist in the main site and WP does not know that it has to remap those urls. IMO, the only way to do that via plugin. I do not know of any plugins that do that.

    Now if you have a WP subdirectory install, I believe that you can do what you want.

  5. We have products.domain.com , and I have to rewrite that url so it shows in web address bar like http://www.domain.com/products. Subfolder products doesnt exist just need to rewrite path in browser.

    If your whole Multisite is set up as subdomains, then no, this won't work. WP does NOT like multiple names for things.

    If products is NOT a part of your multisite, then it can be made to work.

Reply

You must log in to post.

About this Topic