Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a shared host account set up with GoDaddy. I want to host multiple websites, each with their own domain name on the same account. Each site will be in its own subfolder, with only the web.config containing URL Rewrite rules in the root. I have it mostly working, but am unable to get the urls to work to my liking.

One of the sites I have is a Wordpress installation. The problem with this one is that I can't get my "pretty" permalinks working. I need to either include index.php or the subfolder that it resides in as part of the permalink.

I will also be hosting ASP.NET MVC 2 apps, but I want to focus on the Wordpress issue for now because that is more pressing. I only mention these other sites because I want to illustrate what my plans are a little better.

In the root, I have the following web.config file:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.web>
        <identity impersonate="false" /> 
    </system.web>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="somewordpresssite.com" stopProcessing="true">
                    <match url=".*" />
                    <conditions>
                        <add input="{HTTP_HOST}" pattern="^(www.)?somewordpresssite.com" />
                        <add input="{PATH_INFO}" pattern="^/somewordpresssite/" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="\somewordpresssite\{R:0}" />
                </rule>
                <rule name="someaspnetmvcsite.com" stopProcessing="true">
                    <match url=".*" />
                    <conditions>
                        <add input="{HTTP_HOST}" pattern="^(www.)?someaspnetmvcsite.com" />
                        <add input="{PATH_INFO}" pattern="^/someaspnetmvcsite/" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="\someaspnetmvcsite\{R:0}" />
                </rule>
            </rules>
        </rewrite>
        <directoryBrowse enabled="false" />
    </system.webServer>
</configuration>

Then, in my Wordpress subfolder, I have the web.config for the Wordpress site:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <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>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

The URL Rewrite rules in the root seem to be working, at least well enough to have the two domains point to the two different sites. Is there something I need to do different to get pretty permalinks in my Worpress site?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

As it turns out, I needed to change my domain configuration on GoDaddy to get the permalinks I was looking for. The issue I described turned out to only be a problem for my default domain, even though I had it redirect to a subfolder. What I needed to do was create a bogus domain as my default domain so that I could have my real default domain point to the subfolder rather than get redirected to the subfolder. It seems kind of ridiculous, but it worked.

Here's the GoDaddy Help article that explains the process: http://community.godaddy.com/help/article/4067.

After following the steps in the article (which took a little over 24 hours to finish processing), I was also able to delete the web.config file I had originally placed in the root.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.