-1

I want all WordPress installed in multiple directories in root website to rewrite like following example: http://www.example.com/wordpress1/* and http://www.example.com/wordpress2/* to http://www.example.com/* which excludes wp-admin directories and all. Admin URL should be same as original :http://www.example.com/wordpress1/wp-admin/ I am using IIS10.

or rewrite rule for WordPress Multi-site with Sub-directory option like : http://www.example.com/wordpress1/* & http://www.example.com/wordpress2/* to http://www.example.com/* will work with same exemptions.

I will be using a plugin to convert categories into subdomain, so if i use subdomain based WP multi site then there will be 3rd level domain name. example : http://category.subdomain.domain.com But i want it to be 2nd level http://category.domain.com .

Currently my url is http://category.domain.com/subdomain I want to remove that /subdomain part. that’s all.

Dipayan
  • 1
  • 7
  • Then you might want to learn IIS URL Rewrite module and create a few rules, https://learn.microsoft.com/en-us/iis/extensions/url-rewrite-module/creating-rewrite-rules-for-the-url-rewrite-module – Lex Li Jun 12 '20 at 05:12
  • used every thing , but now i think its beyond my capabilities. – Dipayan Jun 12 '20 at 06:14

2 Answers2

0

Please try this rewrite rule. Thie rule will rewrite http://www.example.com/wordpress1/* and http://www.example.com/wordpress2/* to http://www.example.com/* and exclude the URL with wp-admin.

  <rule name="rewrite rule" stopProcessing="true">
                    <match url="(.*)" />
                    <conditions trackAllCaptures="true">
                        <add input="{URL}" pattern="^/[^/]+/(.*)" />
                        <add input="{URL}" pattern="wp-admin" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="{C:1}" />
                </rule>
Jokies Ding
  • 3,374
  • 1
  • 5
  • 10
  • when i put it in web.config :403 - Forbidden: Access is denied. when i put it in web.config and also change Wordpress site url to www.example.com: 403 - Forbidden: Access is denied. – Dipayan Jun 12 '20 at 10:17
  • @Dipayan. Are you sure the target URL is your expected URL? I mean you can access the target URL can be accessed directly? Or do you mean that you need something like friendlyURL? – Jokies Ding Jun 13 '20 at 17:11
0

I have managed a way to do it just by following this tutorial and adding a conditional function to redirect to exact directory by domain name using $_SERVER .

Dipayan
  • 1
  • 7