Forcing www as prefix to domain
-
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.
- The topic ‘Forcing www as prefix to domain’ is closed to new replies.