This forum has been moved here:
Helicon Tech Community Forum

ISAPI_Rewrite 3.0 (Forum Locked Forum Locked)
 Helicon Tech : ISAPI_Rewrite 3.0
Subject Topic: Remove extension .aspx keep querystring
Message |

Joined: 26 March 2009
Posts: 16
Posted: 10 December 2011 at 10:05pm

How do I modify the following to remove .aspx but keep the querystrings if there are any?

RewriteCond %{REQUEST_FILENAME}.aspx -f
RewriteRule (.*) $1.aspx

Edited by guycre8ive - 10 December 2011 at 10:15pm
Back to Top

Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 12 December 2011 at 5:37am


Try using:

RewriteCond %{REQUEST_FILENAME}.aspx -f
RewriteRule (.*) $1.aspx [NC,QSA,L]

QSA flag appends querystring

Back to Top

Joined: 26 March 2009
Posts: 16
Posted: 12 December 2011 at 6:15am

That didn't work.  Is there a knowledge base somewhere that specifies what everything means?  I'm wondering what (\w+) does as well as several other things like the -f, the NC & the L.  I was hoping to use 1 or 2 lines that would rewrite both of the following:

From: mypage.aspx
To: mypage

From: mypage.aspx?id=200
To: mypage?id=200

I'm currenty doing this for every page, not sure if it's right or not but it works:
RewriteRule ^/mypage$ /mypage.aspx [NC,L]
And if there's a querystring, I have to take out the $ like so:
RewriteRule ^/mypage /mypage.aspx [NC,L]

Back to Top

Sorry, you can NOT post a reply.
This forum has been locked by a forum administrator.

Printable version Printable version