Active TopicsActive Topics  Display List of Forum MembersMemberlist  HelpHelp   RegisterRegister  LoginLogin
ISAPI_Rewrite 3.0 support forum
 Helicon Tech : ISAPI_Rewrite 3.0 support forum
Subject Topic: Rewrite approval Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
pratt
Newbie
Newbie


Joined: 07 October 2008
Location: United States
Online Status: Offline
Posts: 5
Posted: 07 October 2008 at 12:04pm | IP Logged Quote pratt

I'm somewhat new to ISAPI, and created a few redirect rules to fix problem's on my site. Could you double check them for me to ensure their compatibility? I would greatly appreciate it.

[ISAPI_Rewrite]
# fix missing slash on folders
RewriteCond Host: (.*)
RewriteRule ([^.?]+[^.?/]) http\://$1$2/ [RP]

# remove default.aspx pages from URLs
RewriteRule (.*)/default.aspx$ $1/ [I,RP]

# remove /.aspx pages from URLs
RewriteRule (.*)/.aspx$ $1/ [I,RP]

To explain the purpose of the last rule, my site has a problem where it will display a page when the following URL is typed in:

mysite.com/dir/.aspx

I wanted to redirect that page to just a slash at the end to prevent any future errors.
Back to Top View pratt's Profile Search for other posts by pratt Visit pratt's Homepage
 
Anton
Moderator Group
Moderator Group


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 4837
Posted: 08 October 2008 at 2:52am | IP Logged Quote Anton

Your rules are correct, but I've made some small fixes:

[ISAPI_Rewrite]
# fix missing slash on folders
RewriteCond Host: (.*)
RewriteRule ([^.?]+[^.?/]) http\://$1$2/ [RP]

# remove default.aspx pages from URLs
RewriteRule (.*/)default\.aspx$ $1 [I,RP]

# remove /.aspx pages from URLs
RewriteRule (.*/)\.aspx$ $1 [I,RP]

__________________
Regards,
Anton
Back to Top View Anton's Profile Search for other posts by Anton
 
pratt
Newbie
Newbie


Joined: 07 October 2008
Location: United States
Online Status: Offline
Posts: 5
Posted: 08 October 2008 at 9:23am | IP Logged Quote pratt

Great, thanks for the help!
Back to Top View pratt's Profile Search for other posts by pratt Visit pratt's Homepage
 
pratt
Newbie
Newbie


Joined: 07 October 2008
Location: United States
Online Status: Offline
Posts: 5
Posted: 14 October 2008 at 11:16am | IP Logged Quote pratt

One of the redirects that I had you look at is breaking the site.

This one here:

# fix missing slash on folders

RewriteCond Host: (.*)

RewriteRule ([^.?]+[^.?/]) http\://$1$2/ [RP]

 

is rewriting relative urls. So /CMSPages/GetCSS.aspx?stylesheetname=PlanetCorporate becomes http://www.cmspages.com/GetCSS/?stylesheetname=PlanetCorporate




Edited by pratt - 14 October 2008 at 11:28am
Back to Top View pratt's Profile Search for other posts by pratt Visit pratt's Homepage
 
pratt
Newbie
Newbie


Joined: 07 October 2008
Location: United States
Online Status: Offline
Posts: 5
Posted: 14 October 2008 at 11:20am | IP Logged Quote pratt

Also, the redirects are adding a second slash to the end of the URL.

Example: http://www.mysite.com//

This problem is occurring when I go to the site without the www's, it then redirects me to the example listed above.


Edited by pratt - 14 October 2008 at 11:29am
Back to Top View pratt's Profile Search for other posts by pratt Visit pratt's Homepage
 
Lexey
Moderator Group
Moderator Group


Joined: 15 August 2002
Location: Russian Federation
Online Status: Offline
Posts: 7598
Posted: 14 October 2008 at 1:45pm | IP Logged Quote Lexey

Quote:
One of the redirects that I had you look at is breaking the site.


What do you mean by "breaking the site"? What particular things are broken?

Quote:
Also, the redirects are adding a second slash to the end of the URL.


None of the above 3 rules could do that. Either you have other rules causing this or a redurect is being performed by your application.
Back to Top View Lexey's Profile Search for other posts by Lexey
 
pratt
Newbie
Newbie


Joined: 07 October 2008
Location: United States
Online Status: Offline
Posts: 5
Posted: 14 October 2008 at 1:49pm | IP Logged Quote pratt

Lexey wrote:
What do you mean by "breaking the site"? What particular things are broken?


The stylesheets stopped working. Once we commented out that redirect, they started working properly.
Back to Top View pratt's Profile Search for other posts by pratt Visit pratt's Homepage
 
Lexey
Moderator Group
Moderator Group


Joined: 15 August 2002
Location: Russian Federation
Online Status: Offline
Posts: 7598
Posted: 14 October 2008 at 1:53pm | IP Logged Quote Lexey

Show a sample URI of a non-working stylesheet and corresponding IIS log record, please.

Edited by Lexey - 14 October 2008 at 1:54pm
Back to Top View Lexey's Profile Search for other posts by Lexey
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You can vote in polls in this forum