I have following rewrite rule to append .aspx
extension if url has no extension.
<rule name="SimpleRewrite" stopProcessing="true">
<match url="^(.*(?<=/)([^/.]*))$" />
<action type="Rewrite" url="{R:1}.aspx" />
</rule>
However the rule is not working:
Error HTTP 500.52 - URL Rewrite Module Error.
The expression "^(.*(?<=/)([^/.]*))$" has an invalid syntax.
However, this regular expression works in .NET. What regular expressions are supported by IIS Url Rewrite Module? How to make positive lookbehind assertion?
perhaps .*/[^/.]+$
would serve your needs? the rewrite would just be "{R:0}.aspx"
edit (in response to comment): if you want to include simple filenames, you could write
^(.*/)?[^/.]+$
It sounds like there may be a simpler solution to your problem that won't require regular expressions, but if not, this may help.
Quick: Try a mod-rewrite clone IIS plugin like ISAPI_Rewrite Lite for complex regular expresions.
Long: A year or so ago I did an ISS deployment of a Drupal site, in which all the primary, secondary and I believe tertiary links were to be handled by Drupal, but deeper legacy content was supposed to be served as normal ( instead of being taken over by Drupal 404 ).
We used ISAPI_Rewrite 3, a "port" ( compatible syntax ) of Apache's mod_rewrite to do the directing between the legacy content and drupal, with a series of Rewrite filters and rules that would check for any content matching the URL in a legacy folder before letting Drupal handle the rest.
http://www.helicontech.com/isapi_rewrite/
ISAPI_Rewrite Lite is free, and had all the features I needed. Plus you can shop around, Helicon isn't the only company that has created a Mod-Rewrite clone plugin for IIS.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.