• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 741
  • 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 HoweDevOps ManagerCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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