• Resolved gregorywolf

    (@gregorywolf)


    Hello – I realize that there have been a number of posts on this topic so I will get right to the point. When I was running a single site installation my site URL was defined as http://www.domain.com. When I converted to multi-site I received a WP system message that recommended that I rename my domain to be domain.com before proceeding. The MS installation is up and running and my main site responds to domain.com, which is to be expected. However, I REALLY need to have my pages in the address bar to be written as http://www.domain.com, NOT domain.com. I have read a number of threads that have suggested providing a write rule while other responses simply say install MS using http://www.domain.com and everything will work as I desire.

    So here are the questions:

    1. Is there any adverse reason why I should NOT install MS using http://www.domain.com?

    2. If I choose the leave my site URL as domain.com and “fix” it using a rewrite rule can someone please provide exact steps for making this work. I am running on IIS using the rewrite module. My current web.config is as follows:

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
      <system.webServer>
        <rewrite>
          <rules>
                    <clear />
                    <rule name="Lawnside" stopProcessing="true">
                        <match url="(.*)" />
                        <conditions logicalGrouping="MatchAll" trackAllCaptures="true">
                            <add input="{HTTP_HOST}" pattern="^(www.)?(lawnside).com" />
                        </conditions>
                        <serverVariables>
                            <set name="HTTP_HOST" value="hilltop-tech.com" />
                        </serverVariables>
                        <action type="Redirect" url="http://{HTTP_HOST}/{C:2}" appendQueryString="false" />
                    </rule>
                    <rule name="Single Site Rule" patternSyntax="Wildcard">
                        <match url="*" />
                        <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                        </conditions>
                        <action type="Rewrite" url="index.php" logRewrittenUrl="true" />
                    </rule>
                    <rule name="WordPress Rule 1" stopProcessing="true">
                        <match url="^index\.php$" ignoreCase="false" />
                        <conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
                        <action type="None" />
                    </rule>
                    <rule name="WordPress Rule 2" stopProcessing="true">
                        <match url="^([_0-9a-zA-Z-]+/)?wp-admin$" ignoreCase="false" />
                        <conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
                        <action type="Redirect" url="{R:1}wp-admin/" redirectType="Permanent" />
                    </rule>
                    <rule name="WordPress Rule 3" stopProcessing="true">
                        <match url="^" ignoreCase="false" />
                        <conditions logicalGrouping="MatchAny" trackAllCaptures="false">
                            <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" />
                            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" />
                        </conditions>
                        <action type="None" />
                    </rule>
                    <rule name="WordPress Rule 4" stopProcessing="true">
                        <match url="^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*)" ignoreCase="false" />
                        <conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
                        <action type="Rewrite" url="C:/wordpress/{R:1}" />
                    </rule>
                    <rule name="WordPress Rule 5" stopProcessing="true">
                        <match url="^([_0-9a-zA-Z-]+/)?([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" />
                        <conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
                        <action type="Rewrite" url="C:/wordpress/{R:2}" />
                    </rule>
                    <rule name="WordPress Rule 6" stopProcessing="true">
                        <match url="." ignoreCase="false" />
                        <conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
                        <action type="Rewrite" url="index.php" />
                    </rule>
          	</rules>
          </rewrite>
      </system.webServer>
    </configuration>

    The problem I am having is that no matter where I place the rewrite rule nothing gets changed.

    Any direction/help would be much appreciated. Thank you.

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

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    Is there any adverse reason why I should NOT install MS using http://www.domain.com?

    Yes, but it’s pretty restricted to using SubDOMAINS. Basically WP can get confused and thinks WWW is a subdomain, not the main domain. It’s a perfect storm of things I can’t reproduce regularly, but sometimes, on some instances, when you use WWW, you will end up not being able to upgrade via the network admin.

    If you’re using subFOLDERs you’re usually okay, but I don’t know for sure.

    If I choose the leave my site URL as domain.com and “fix” it using a rewrite rule can someone please provide exact steps for making this work.

    Ugh. IIS.

    I think this is still valid: http://weblogs.asp.net/owscott/archive/2009/11/27/iis-url-rewrite-rewriting-non-www-to-www.aspx

    But literally what I know of IIS is “It doesn’t use .htaccess”

    Thread Starter gregorywolf

    (@gregorywolf)

    Hello – I apologize for the delayed response. After much work I have finally thrown in the towel trying to get IIS Rewrite rules working properly. Instead I have implemented a 3rd party package from Helicon Tech (http://www.helicontech.com) called Helicon Ape. It replaces the MS Rewrite module but instead of using an XML format it uses .htaccess and it works great. It is so much easier to use and follows the standard .htaccess syntax.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Forcing www as prefix to domain’ is closed to new replies.