This project is read-only.

RewriteRule with dash

Jan 18, 2012 at 7:03 PM

Is it just me, or does Rewrite Rules (Version: 1.2.5) seems to break when using a dash (in an attempt to have a rewrite rule doing nothing)? Like this:
RewriteEngine On
RewriteRule !^.*\.asp.*$ - [L, NC]
RewriteRule ^.*id=123.*$  /new-test-page [R=301, NC]

Snip from the Stack Trace:
Exception Details: System.ArgumentException: The virtual path '/Admin/Settings/Rewrite%20Rules' maps to another application, which is not allowed.
Source File: e:\Orchard.Source.1.3.10\src\Orchard.Web\Modules\Contrib.RewriteRules\Services\TransferResult.cs    Line: 25

I'm testing the module to make a redirect of a bunch of old URLs (about 100) from an old CMS, to a new Orchard website with new more friendly URLs. I would make a rewrite rule for almost every new url (the old are like .asp?id=102 ...), causing a lot of lines. 

The above RewriteRule should stop the mod_rewrite in the beginning (if the path doesn't match, the L flag should stop the mod_rewrite), to avoid evaluating all the RewriteRules, if the URL doesn't match the regex anyway (I don't know if that is necessary at all, but I just liked the idea - lol). It seems to work well in the Simulation page btw.