Quantcast
Channel: All Forums
Viewing all articles
Browse latest Browse all 27852

URL Rewrite rule for subdomain hosted in subfolder inside root.

$
0
0

I have two domains and a sub domain hosted on single server. Below is the hierarchy I am using:

  1. Primary domain:               Domain1.com using root folder( \)
  2. Secondary domain:         Domain2.com using “domain2” folder inside root (\domain2)
    1. Sub domain:       Blogs.domain2.com using “blogs” folder inside domain2 (\domain2\blogs)

I’ve installed WordPress application in root and sub domain folder which generates 2 identical web.config, one for each instance. Below is the rule settings in both the web.config file.

<rule name="wordpress" patternSyntax="Wildcard"><match url="*"/><conditions><add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/><add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/></conditions><action type="Rewrite" url="index.php"/></rule>

Now problem is whenever I try to open application hosted in sub domain folder, it crashed. I contact hosting service support and they told me this is problem of web.config file and they cannot provide any support since it is coding problem.

I google this problem and found that it is a problem of rewrite rules in config file. After I changed the rule name in sub domain file to “subdomain” application main page renders perfectly but when I navigate to some other page of sub domain, it redirects me to the application hosted in root directory.  I try changing rules in web.config of root folder and sub domain folder both but could not fix this problem.

What I want is that if request comes for sub domain application, it should use contents inside the “\domain2\blogs” folder.

 

I don’t have much idea about Url rewriting module. Please help.

 


Viewing all articles
Browse latest Browse all 27852

Trending Articles