If you’re running YOURLS on an IIS 7 box you’ll need the correct settings in your web.config to perform the URL Rewriting. An example web.config with the correct settings is below.
Note the security section which disables some paranoid protection IIS has switched on by default. If your server doesn’t allow double escaping of request strings, the YOURLS links with a + in them don’t work. This breaks the admin interface and the stats reporting pages.
The rest of the web.config is standard stuff to fix a non-canonical hostname, and make sure the IDs are rewritten to the right pages:
<system.webServer> <security> <requestFiltering allowDoubleEscaping="true" /> </security> <rewrite> <rules> <rule name="Canonical Host Name" stopProcessing="true"> <match url="(.*)" /> <conditions> <add input="{HTTP_HOST}" negate="true" pattern="^domain\.com$" /> </conditions> <action type="Redirect" url="http://domain.com/{R:1}" redirectType="Permanent" /> </rule> <rule name="YOURLS 1" stopProcessing="true"> <match url="^([0-9A-Za-z]+)/?$" ignoreCase="false" /> <conditions logicalGrouping="MatchAll"> <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" /> </conditions> <action type="Rewrite" url="/yourls-go.php?id={R:1}" appendQueryString="false" /> </rule> <rule name="YOURLS 2" stopProcessing="true"> <match url="^([0-9A-Za-z]+)\+/?$" ignoreCase="false" /> <action type="Rewrite" url="/yourls-infos.php?id={R:1}" appendQueryString="false" /> </rule> <rule name="YOURLS 3" stopProcessing="true"> <match url="^([0-9A-Za-z]+)\+all/?$" ignoreCase="false" /> <action type="Rewrite" url="/yourls-infos.php?id={R:1}&all=1" appendQueryString="false" /> </rule> </rules> </rewrite> </system.webServer> |