• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 726
  • Last Modified:

IIS 7 - URL Rewrite

Hi Experts,

I would like to rewrite a URL using the IIS URL Rewrite Tool like this:

ORGINAL URL => https://server.domain.com/username.v2/Documents
FRIENDLY URL => https://server.domain.com/username

Basically I just want to add ".v2/Documents" on the back of every URL that is requested.

Also can you confirm whether this URL rewrite will work through WebDAV. The idea of this is to allow our iPad users access to their "My Docs" through a simple webdav client on the iPad, and the rewrite is in order to make it as easy as possible for them, all they have to do is remember there username!

Thanks,

Jaggie
0
JohnGerhardt
Asked:
JohnGerhardt
  • 2
2 Solutions
 
Brad HoweCommented:
As long as you have IIS URL Rewrite module instaled, this will work for you.

IIS URL Rewrite Module 2.0
http://www.iis.net/download/urlrewrite

Root web.config example. You may only need to add the <rewrite section> if one exists.

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="Rewrite User Friendly .v2/Documents" stopProcessing="true">
                    <match url="^username$" />
                    <conditions>
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="username.v2/Documents" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

Cheers,
Hades666
0
 
JohnGerhardtAuthor Commented:
I can't get this to work although after playing around this works..

<rewrite>
            <rules>
                <rule name="Rewrite User Friendly .v2/Documents" stopProcessing="true">
                    <match url="^..." />
                    <conditions>
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="{R:0}.v2/Documents" />
                </rule>
            </rules>
        </rewrite>

Not sure why the other one doesn't work.

Thanks!
0
 
JohnGerhardtAuthor Commented:
The Expert pointed me in the correct direction.

Thanks!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now