| Author |
|
pratt Newbie

Joined: 07 October 2008 Location: United States
Online Status: Offline Posts: 5
|
| Posted: 07 October 2008 at 12:04pm | IP Logged
|
|
|
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 |
|
| |
Anton Moderator Group

Joined: 30 January 2007 Location: Ukraine
Online Status: Offline Posts: 4837
|
| Posted: 08 October 2008 at 2:52am | IP Logged
|
|
|
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 |
|
| |
pratt Newbie

Joined: 07 October 2008 Location: United States
Online Status: Offline Posts: 5
|
| Posted: 08 October 2008 at 9:23am | IP Logged
|
|
|
Great, thanks for the help!
|
| Back to Top |
|
| |
pratt Newbie

Joined: 07 October 2008 Location: United States
Online Status: Offline Posts: 5
|
| Posted: 14 October 2008 at 11:16am | IP Logged
|
|
|
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 |
|
| |
pratt Newbie

Joined: 07 October 2008 Location: United States
Online Status: Offline Posts: 5
|
| Posted: 14 October 2008 at 11:20am | IP Logged
|
|
|
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 |
|
| |
Lexey Moderator Group

Joined: 15 August 2002 Location: Russian Federation
Online Status: Offline Posts: 7598
|
| Posted: 14 October 2008 at 1:45pm | IP Logged
|
|
|
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 |
|
| |
pratt Newbie

Joined: 07 October 2008 Location: United States
Online Status: Offline Posts: 5
|
| Posted: 14 October 2008 at 1:49pm | IP Logged
|
|
|
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 |
|
| |
Lexey Moderator Group

Joined: 15 August 2002 Location: Russian Federation
Online Status: Offline Posts: 7598
|
| Posted: 14 October 2008 at 1:53pm | IP Logged
|
|
|
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 |
|
| |