Redirect all requests for .aspx pages to one page

ISAPI_Rewrite is Apache mod_rewrite compatible URL rewriter for Microsoft IIS
User avatar
Posts: 2
Joined: 25 Sep 2014, 17:28

Redirect all requests for .aspx pages to one page

25 Sep 2014, 17:32

Hello, with ISRW 3, how can I redirect requests for any page ending in .aspx to a single page that is not an aspx page?

Thanks,

CXL

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: Redirect all requests for .aspx pages to one page

25 Sep 2014, 21:02

Try using:

Code: Select all
RewriteEngine on
RewriteBase /

RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{REUQEST_URI} \.aspx$
RewriteRule (.+) /any/other/Non/aspx/page [NC,R=301,L]


Regards

User avatar
Posts: 2
Joined: 25 Sep 2014, 17:28

Re: Redirect all requests for .aspx pages to one page

25 Sep 2014, 21:58

Is there any downside to using this or a reason not to?

RewriteRule ^(.*?.aspx) /hello.html [I]

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: Redirect all requests for .aspx pages to one page

26 Sep 2014, 16:52

I can see only one - [L]flag. But it's really up to you. If you have other rules below this one, it will save time and requests wouldn't go down the config file.

Code: Select all
RewriteRule ^(.*?.aspx) /hello.html [NC,L]


Regards

Return to ISAPI_Rewrite 3.0

Who is online

Users browsing this forum: No registered users and 19 guests