Thank you i just used rules given, however had problems with too many redirects error.
I placed your rules at web.config file, after failing at first try, i thought same rule names would be the issue, because both rules have RedirectUserFriendlyURL1 as rulename, in the past with iis6, i had to use different rulenames with ISAPI extensions.
I changed second rulename to have a uniqe one, it didn't help too...
There is only a warning in the output of Failed Request Tracing. The warning is expected because of {REQUEST_METHOD} being used in rewrite rules.
The log indicates request "pansiyon/tabid/63/acenta/View/pansiyonID/31/Sirince-Doga-Pansiyon.aspx" was redirected to "63/31/Sirince-Doga-Pansiyon". And the request "63/31/Sirince-Doga-Pansiyon" was rewrote to "pansiyon/tabid/63/acenta/View/pansiyonID/31/Sirince-Doga-Pansiyon.aspx"
successfully.
Could you please give us more detailed information about the error you encounter in this case?
Thanks.
Please mark the replies as answers if they help or unmark if not.
Feedback to us
14 Posts
I need a Few Rules
Aug 27, 2010 01:37 PM|idumlupinar|LINK
I have a website which lists hostel details and sample url shows hostel detail page.
http://www.hostelbookingdomainx.com/hostel/tabid/63/agent/View/hostelID/22/Some-Hostel-Name-Here.aspx
As you see above url is pretty long.
I have about 10000 urls like this in my portal.
So, i want to use some rules to shorten my urls.
For example:
instead of http://www.hostelbookingdomainx.com/hostel/tabid/63/agent/View/hostelID/22/Some-Hostel-Name-Here.aspx
http://www.hostelbookingdomainx.com/Some-Hostel-Name-Here.aspx
would be more promising.
So i think i need a rule to remove /hostel/tabid/63/agent/View/hostelID/22 from the url:
Note: 63 is a fixed numeric value (comes from page tabid)
22 is a dynamic value comes from database column called HostelID, so i need a wildcard rule.
I am also open to ideas which way is better:
http://www.hostelbookingdomainx.com/Some-Hostel-Name-Here.aspx,
http://www.hostelbookingdomainx.com/22/Some-Hostel-Name-Here.aspx
http://www.hostelbookingdomainx.com/hostel/22/Some-Hostel-Name-Here.aspx
I also want to prevent duplicate content penalty after creating new rules, so i think i will need friendly redirects right?
Please advise.
Thank you.
iis seo url rewrite2.0
4141 Posts
Re: I need a Few Rules
Sep 01, 2010 04:32 AM|Leo Tang - MSFT|LINK
Hi,
I think the possible short URL for you here is :
http://www.hostelbookingdomainx.com/63/22/Some-Hostel-Name-Here
The rules look like:
<system.webServer>
<rewrite>
<rules>
<rule name="RedirectUserFriendlyURL1" stopProcessing="true">
<match url="^hostel/tabid/([0-9]+)/agent/View/hostelID/([0-9]+)/([^/]+)\.aspx$" />
<conditions>
<add input="{REQUEST_METHOD}" pattern="^POST$" negate="true" />
</conditions>
<action type="Redirect" url="/{R:1}/{R:2}/{R:3}" appendQueryString="false" />
</rule>
<rule name="RewriteUserFriendlyURL1" stopProcessing="true">
<match url="^([0-9]+)/([0-9]+)/([^/]+)/?$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="hostel/tabid/{R:1}/agent/View/hostelID/{R:2}/{R:3}.aspx" />
</rule>
</rules>
</rewrite>
</system.webServer>
URL Rewrite Module
http://learn.iis.net/page.aspx/734/url-rewrite-module/
Thanks.
Feedback to us
14 Posts
Re: I need a Few Rules
Sep 04, 2010 10:44 AM|idumlupinar|LINK
Thank you i just used rules given, however had problems with too many redirects error.
I placed your rules at web.config file, after failing at first try, i thought same rule names would be the issue, because both rules have RedirectUserFriendlyURL1 as rulename, in the past with iis6, i had to use different rulenames with ISAPI extensions.
I changed second rulename to have a uniqe one, it didn't help too...
FYI: I also have following at my web.config:
<rewrite>
<rewriteMaps>
<rewriteMap name="StaticRewrites">
</rewriteMap>
</rewriteMaps>
</rewrite>
I don't know where does it come from, maybe a third party plugin that i use called PageBlaster.
My main application is DotNetNuke CMS.
Please advise, thank you.
4141 Posts
Re: I need a Few Rules
Sep 06, 2010 02:49 AM|Leo Tang - MSFT|LINK
Hi,
Could you please enable Failed Request Tracing to see how rewrite rules were applied to request URL?
Using Failed Request Tracing to Trace Rewrite Rules
http://learn.iis.net/page.aspx/467/using-failed-request-tracing-to-trace-rewrite-rules/
Thanks.
Feedback to us
14 Posts
Re: I need a Few Rules
Sep 07, 2010 03:17 AM|idumlupinar|LINK
Can you review the logs below and tell me my mistake?
http://bit.ly/a1o5mo
Thank you.
4141 Posts
Re: I need a Few Rules
Sep 08, 2010 06:03 AM|Leo Tang - MSFT|LINK
Hi,
There is only a warning in the output of Failed Request Tracing. The warning is expected because of {REQUEST_METHOD} being used in rewrite rules.
The log indicates request "pansiyon/tabid/63/acenta/View/pansiyonID/31/Sirince-Doga-Pansiyon.aspx" was redirected to "63/31/Sirince-Doga-Pansiyon". And the request "63/31/Sirince-Doga-Pansiyon" was rewrote to "pansiyon/tabid/63/acenta/View/pansiyonID/31/Sirince-Doga-Pansiyon.aspx" successfully.
Could you please give us more detailed information about the error you encounter in this case?
Thanks.
Feedback to us
14 Posts
Re: I need a Few Rules
Sep 08, 2010 06:08 AM|idumlupinar|LINK
14 Posts
Re: I need a Few Rules
Sep 08, 2010 08:25 AM|idumlupinar|LINK
Leo, http://forums.iis.net/t/1150403.aspx The problem mentioned here has been fixed?
While playing with the code you gave me earlier, i stopped redirect problem with changing
<match url="^pansiyon/tabid/([0-9]+)/acenta/View/pansiyonID/([0-9]+)/([^/]+)\.aspx$" />
to (\ becomes /)
<match url="^pansiyon/tabid/([0-9]+)/acenta/View/pansiyonID/([0-9]+)/([^/]+)/.aspx$" />
and it redirected to long url properly,
However short ulr didn't stay on address bar of browser,
I'm still looking for other possibilities,
By the way my cms does not generate physical files, could it be an issue?
Also, which mode is better for url rewrite, integrated or classic?
UPDATE: Can i post my web.config to you as a PM?