IIS URL Rewrite - create short URL

733 views Asked by At

I want to have URLs in the following format: http://example.com/siteID/page-name/

I need to rewrite them to http://example.com/template.asp?page=siteID-page-name

Since Brandon pointed out that I got my source and target mixed up, I fixed web.config, which now correctly rewrites URLs using the following rules:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
 <system.webServer>
  <rewrite>
   <rules>
    <rule name="URL Rewrite" stopProcessing="true">
     <match url="^siteID$" />
     <action type="Rewrite" url="template.asp?page=siteID-{R:1}" />
    </rule>
   </rules>
  </rewrite>
 </system.webServer>
</configuration>

Although the URL is now being correctly rewritten, all my referenced files (CSS, JS, ASP includes, etc.) can no longer be found.

What is the best way to handle that?

Any help is greatly appreciated!

0

There are 0 answers