Just a simple question. I have a domain website.com, and this page have specific pages named with country code.
I've created rule on my web.config file with the following URl rewrite:
<rule name="RewriteUserFriendlyURL1" stopProcessing="true">
<match url= "^([^/]+)/?$"/>
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="ContactUs.php?lang={R:1}" />
</rule>
Pages are generated in PHP, variable called lang is used to display the choosen page and is present in URL.
I would like to add "contact/" between my domain and pages.
I have the following rule :
<rule name="RewriteUserFriendlyURL1" stopProcessing="true">
<match url="contact([^/]+)/?$"/>
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="ContactUs.php?lang={R:1}"/>
</rule>
I anyone can explain me what did I didn't understand, Thanks
Your regular expression is slightly wrong.
^contact\/([a-z]+)\/?$
That should do what you need it to, assuming all your country codes are letters only.