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: ASP.NET 4.0 & WCF
Author
Message |
pimplic
Newbie


Joined: 22 October 2010
Posts: 19
Posted: 02 November 2011 at 5:56pm

Our site runs in 4.0, we disabled the extensionlessurl
and everything was working perfectly.

Our rules are straightforward:

Code:

RewriteCond %{HTTPS} (on)?
RewriteCond %{HTTP:Host} ^(?!www\.)(.+)$ [NC]
RewriteCond %{REQUEST_URI} (.+)
RewriteRule .? http(?%1s)://www.%2%3 [R=301,L]
RewriteRule ^tour$ tour/default.aspx


There is only one exception that you guys helped us
with... we redirect pages like this:
http://www.mysite.com/myname -->
http://www.mysite.com/memberdetails?id=myname with the
following rules...I am adding these as a reference.

Code:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(?!(?:team|careers|dashboard).*)([^/]+)$
memberdetails.aspx?uid=$1 [NC,L]


The problem started recently when we implemented a WCF
4.0 which requires the extensionless to be turned on...
As you know, if we turn it on for WCF our website won't
work anymore and viceversa...

I tried to turn it on and test the following option that
I found on your forum but didn't work.


Code:

RewriteCond %{HTTPS} (on)?
RewriteCond %{HTTP:Host} ^(?!(?:www\.|\d|localhost))(.+)$
[NC]
RewriteCond %{REQUEST_URI} (.+)
RewriteRule ^(.*)(eurl.axd/.*)$ http(?%1s)://%2/$1
[R=301,L]


I've seen that people reported this problem since 2010.
Is there any way to keep both WCF 4.0 and a website with
the above rules.

Please advise.
Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 03 November 2011 at 8:45am

Hello,

Please, clarify. Do you want to apply WCF for the whole site or for a part of it?
The reason for the clarification is that we can adjust the workaround provided for your team|careers|dashboard, and leave all the rest URLs with extensionless.

regards
Andrew
Back to Top
 
pimplic
Newbie


Joined: 22 October 2010
Posts: 19
Posted: 03 November 2011 at 2:43pm

Hi Andrew...yes the new WCF is a separate domain... so I think adjusting the rules I sent you to make the original website work with the extensionless url on, sounds like a good idea.

Please let me know and thanks for your quick reply
Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 04 November 2011 at 9:00am

Hello,

Try using smth like the following putting it on top of the rules:

RewriteCond %{HTTPS} (on)?
RewriteCond %{HTTP:Host} ^(?!(?:www\.WCFdomain|WCFdomain).*)(.+)$ [NC]
RewriteCond %{REQUEST_URI} (.+)
RewriteRule ^(.*)(eurl.axd/.*)$ http(?%1s)://%2/$1 [R=301,L]

In case the rule doesn't work, please, provide the rewrite.log for the testing request.
Logging issue are described in FAQ

Regards
Andrew
Back to Top
 
pimplic
Newbie


Joined: 22 October 2010
Posts: 19
Posted: 04 November 2011 at 4:58pm

OK So I applied the rule you sent me...

Code:

RewriteCond %{HTTPS} (on)?
RewriteCond %{HTTP:Host} ^(?!
(?:www\.WCFdomain|WCFdomain).*)(.+)$ [NC]
RewriteCond %{REQUEST_URI} (.+)
RewriteRule ^(.*)(eurl.axd/.*)$ http(?%1s)://%2/$1
[R=301,L]


I only added one line
Code:
RewriteCond %{HTTP:Host} ^(?!
(?:www\.|\d|localhost))(.+)$ [NC]


so my httaccess looks like this:
Code:

RewriteCond %{HTTPS} (on)?
RewriteCond %{HTTP:Host} ^(?!(?:api.brows.com).*)(.+)$
[NC]
RewriteCond %{HTTP:Host} ^(?!(?:www\.|\d|localhost))(.+)$
[NC]
RewriteCond %{REQUEST_URI} (.+)
RewriteRule ^(.*)(eurl.axd/.*)$
http(?%1s)://%2/$1 [R=301,L]
RewriteRule ^tour$ tour/default.aspx
RewriteRule ^error$ _errors/error.aspx
RewriteRule ^error/404$ _errors/error404Page.aspx
RewriteRule ^error/500$ _errors/error500Page.aspx

RewriteRule ^preview/([^/]+) memberpreview.aspx?uid=$1
[NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(?!
(?:community/browse|community/search|favicon.ico|careers|
joinourteam|membernotfound|getverified|redirect|linkedinc
onnect|linkedincallback|myspaceconnect|myspacecallback|ev
entnotfound|msncallback|resetpassword|plugins|widgets|too
ls|tour|taketour|features|private|error|facebookconnect|s
ignupthirdparty|twitterconnect|facebookcallback|twitterca
llback|facebookdeauthorize|twitterdeauthorize|contests|un
subscribe|about|widgets|team|betatest|nonprofit|faq|brows
e|codeofhonor|contactus|eventclosed|eventpending|partnerw
ithus|press|privacy|reportbug|search|signin|signout|switc
huser|signup|termsofservice|dcma|termsofsalepurchase|uima
gineterms|uimagineagreement|updatebrowser|learnmore|verif
y|invitecode|exclusive|network|notification|share|directo
ry|invite|getverify|getsticker|careers|dashboard).*)
([^/]+)$ memberdetails.aspx?uid=$1 [NC,L]



I have excluded some repetitive rules.

I Turned the extensionless on, my api.browsn.com works
fine.

Then I browse my site www.browsn.com, default page works
fine but once I click on www.browsn.com/signup I get
"page not found".

The signup page is excluded in this rule, basically none
of the pages inside this rule, won't work.

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(?!
(?:community/browse|community/search|favicon.ico|careers|
joinourteam|membernotfound|getverified|redirect|linkedinc
onnect|linkedincallback|myspaceconnect|myspacecallback|ev
entnotfound|msncallback|resetpassword|plugins|widgets|too
ls|tour|taketour|features|private|error|facebookconnect|s
ignupthirdparty|twitterconnect|facebookcallback|twitterca
llback|facebookdeauthorize|twitterdeauthorize|contests|un
subscribe|about|widgets|team|betatest|nonprofit|faq|brows
e|codeofhonor|contactus|eventclosed|eventpending|partnerw
ithus|press|privacy|reportbug|search|signin|signout|switc
huser|signup|termsofservice|dcma|termsofsalepurchase|uima
gineterms|uimagineagreement|updatebrowser|learnmore|verif
y|invitecode|exclusive|network|notification|share|directo
ry|invite|getverify|getsticker|careers|dashboard).*)
([^/]+)$ memberdetails.aspx?uid=$1 [NC,L]


If you take a look at my log file below, the signup looks
like this

signup/eurl.axd/f67b35875662334093c50a8d677e2e83

so something is not working...

please let me know, and thanks for your help!


(2) init rewrite engine with requested uri /signup/eurl.axd/f67b35875662334093c50a8d677e2e83
(1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
(1) Htaccess process request d:\browsn\.htaccess
(3) applying pattern '^(.*)(eurl.axd/.*)$' to uri 'signup/eurl.axd/f67b35875662334093c50a8d677e2e83'
(4) RewriteCond: input='off' pattern='(on)?' => matched
(4) RewriteCond: input='www.browsn.com' pattern='^(?!(?:api.browsn.com).*)(.+)$' => matched
(4) RewriteCond: input='www.browsn.com' pattern='^(?!(?:www\.|\d|localhost))(.+)$' => not-matched
(3) applying pattern '^tour$' to uri 'signup/eurl.axd/f67b35875662334093c50a8d677e2e83'
(3) applying pattern '^preview/([^/]+)' to uri 'signup/eurl.axd/f67b35875662334093c50a8d677e2e83'
(3) applying pattern '^(?! (?:community/browse|community/search|favicon.ico|careers|....|getsticker|careers|dashboard).*)([^/]+)$' to uri
signup/eurl.axd/f67b35875662334093c50a8d677e2e83'
(3) applying pattern '.?' to uri 'signup/eurl.axd/f67b35875662334093c50a8d677e2e83'
(4) RewriteCond: input=''pattern='(?:union%20|%3Cscript%20|/\*|insert%20|sysobjects|;-- |@@|declare%20|drop%20|benchmark%20|sp_password%20|%3b|char\(|'%22)' => not-matched


(2) init rewrite engine with requested uri /favicon.ico
(1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
(1) Htaccess process request d:\browsn\.htaccess
(3) applying pattern '^(.*)(eurl.axd/.*)$' to uri 'favicon.ico'
(3) applying pattern '^tour$' to uri 'favicon.ico'
(3) applying pattern '^error$' to uri 'favicon.ico'
(3) applying pattern '^error/404$' to uri 'favicon.ico'
(3) applying pattern '^error/500$' to uri 'favicon.ico'
(3) applying pattern '^preview/([^/]+)' to uri 'favicon.ico'
(3) applying pattern '^(?! (?:community/browse|...|dashboard).*)([^/]+)$' to uri 'favicon.ico'
(3) applying pattern '.?' to uri 'favicon.ico'
(4) RewriteCond: input=''pattern='(?:union%20|%3Cscript%20|/\*|insert%20|sysobjects|;-- |@@|declare%20|drop%20|enchmark%20|sp_password%20|%3b|char\(|'%22)' => not-matched




Edited by AndrushkaUS - 07 November 2011 at 3:39am
Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 07 November 2011 at 5:43am

Ihave edited your log to make it easier to understand.\
As you can see;

Quote:
(4) RewriteCond: input='www.browsn.com' pattern='^(?!(?:api.browsn.com).*)(.+)$' => matched
(4) RewriteCond: input='www.browsn.com' pattern='^(?!(?:www\.|\d|localhost))(.+)$' => not-matched


Try using [OR] flag after first condition.

Regards
Andrew
Back to Top
 
pimplic
Newbie


Joined: 22 October 2010
Posts: 19
Posted: 07 November 2011 at 4:19pm

So Sorry Andrew...didn't get you..."try using [OR] flag
after first condition...

Code:

RewriteCond %{HTTPS} (on)?
RewriteCond %{HTTP:Host} ^(?!(?:api.browsn.com).*)(.+)$
[NC]
RewriteCond %{HTTP:Host} ^(?!(?:www\.|\d|localhost))(.+)$
[NC]
RewriteCond %{REQUEST_URI} (.+) RewriteRule ^(.*)
(eurl.axd/.*)$ http(?%1s)://%2/$1 [R=301,L]



how should it look?

Also, I thought the problem was with the signup
signup/eurl.axd/f67b35875662334093c50a8d677e2e83

please advise.
Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 08 November 2011 at 4:21am

Hello,

Try this:

RewriteCond %{HTTPS} (on)?
RewriteCond %{HTTP:Host} ^(?!(?:api.browsn.com).*)(.+)$ [NC,OR]
RewriteCond %{HTTP:Host} ^(?!(?:www\.|\d|localhost))(.+)$ [NC]
RewriteCond %{REQUEST_URI} (.+)
RewriteRule ^(.*)(eurl.axd/.*)$ http(?%1s)://%2/$1 [R=301,L]

Regards
Andrew
Back to Top
 
pimplic
Newbie


Joined: 22 October 2010
Posts: 19
Posted: 08 November 2011 at 2:54pm

Hi Andrew,
I applied the following rules:

Code:
RewriteCond %{HTTPS} (on)? RewriteCond %{HTTP:Host}
^(?!(?:api.browsn.com).*)(.+)$ [NC,OR] RewriteCond %
{HTTP:Host} ^(?!(?:www\.|\d|localhost))(.+)$ [NC]
RewriteCond %{REQUEST_URI} (.+) RewriteRule ^(.*)
(eurl.axd/.*)$ http(?%1s)://%2/$1 [R=301,L]



unfortunately now I get the following error msg :

"This webpage has a redirect loop"

below the log file which has the following results
multiple times...I just copied the first 2.

51.93.164.xx 51.93.164.xx Tue, 08-Nov-2011 12:41:08 GMT
[www.browsn.com/sid#2028810799][rid#38808808/initial] (2)
init rewrite engine with requested uri
/eurl.axd/5ac413b0e6c0654eb2bb597f9c68bf7b/
51.93.164.xx 51.93.164.xx Tue, 08-Nov-2011 12:41:08 GMT
[www.browsn.com/sid#2028810799][rid#38808808/initial] (1)
Htaccess process request C:\Program
Files\Helicon\ISAPI_Rewrite3\httpd.conf
51.93.164.xx 51.93.164.xx Tue, 08-Nov-2011 12:41:08 GMT
[www.browsn.com/sid#2028810799][rid#38808808/initial] (1)
Htaccess process request d:\browsn\.htaccess
51.93.164.xx 51.93.164.xx Tue, 08-Nov-2011 12:41:08 GMT
[www.browsn.com/sid#2028810799][rid#38808808/initial] (3)
applying pattern '^(.*)(eurl.axd/.*)$' to uri
'eurl.axd/5ac413b0e6c0654eb2bb597f9c68bf7b/'
51.93.164.xx 51.93.164.xx Tue, 08-Nov-2011 12:41:08 GMT
[www.browsn.com/sid#2028810799][rid#38808808/initial] (4)
RewriteCond: input='off' pattern='(on)?' => matched
51.93.164.xx 51.93.164.xx Tue, 08-Nov-2011 12:41:08 GMT
[www.browsn.com/sid#2028810799][rid#38808808/initial] (4)
RewriteCond: input='www.browsn.com' pattern='^(?!
(?:api.browsn.com).*)(.+)$' => matched
51.93.164.xx 51.93.164.xx Tue, 08-Nov-2011 12:41:08 GMT
[www.browsn.com/sid#2028810799][rid#38808808/initial] (4)
RewriteCond:
input='/eurl.axd/5ac413b0e6c0654eb2bb597f9c68bf7b/'
pattern='(.+)' => matched
51.93.164.xx 51.93.164.xx Tue, 08-Nov-2011 12:41:08 GMT
[www.browsn.com/sid#2028810799][rid#38808808/initial] (1)
escaping http://www.browsn.com/
51.93.164.xx 51.93.164.xx Tue, 08-Nov-2011 12:41:08 GMT
[www.browsn.com/sid#2028810799][rid#38808808/initial] (2)
explicitly forcing redirect with http://www.browsn.com/
51.93.164.xx 51.93.164.xx Tue, 08-Nov-2011 12:41:08 GMT
[www.browsn.com/sid#2028810799][rid#38808808/initial] (2)
internal redirect with
/eurl.axd/5ac413b0e6c0654eb2bb597f9c68bf7b/ [INTERNAL
REDIRECT]

51.93.164.xx 51.93.164.xx Tue, 08-Nov-2011 12:41:08 GMT
[www.browsn.com/sid#2028810799][rid#38808808/initial] (2)
init rewrite engine with requested uri
/eurl.axd/5ac413b0e6c0654eb2bb597f9c68bf7b/
51.93.164.xx 51.93.164.xx Tue, 08-Nov-2011 12:41:08 GMT
[www.browsn.com/sid#2028810799][rid#38808808/initial] (1)
Htaccess process request C:\Program
Files\Helicon\ISAPI_Rewrite3\httpd.conf
51.93.164.xx 51.93.164.xx Tue, 08-Nov-2011 12:41:08 GMT
[www.browsn.com/sid#2028810799][rid#38808808/initial] (1)
Htaccess process request d:\browsn\.htaccess
51.93.164.xx 51.93.164.xx Tue, 08-Nov-2011 12:41:08 GMT
[www.browsn.com/sid#2028810799][rid#38808808/initial] (3)
applying pattern '^(.*)(eurl.axd/.*)$' to uri
'eurl.axd/5ac413b0e6c0654eb2bb597f9c68bf7b/'
51.93.164.xx 51.93.164.xx Tue, 08-Nov-2011 12:41:08 GMT
[www.browsn.com/sid#2028810799][rid#38808808/initial] (4)
RewriteCond: input='off' pattern='(on)?' => matched
51.93.164.xx 51.93.164.xx Tue, 08-Nov-2011 12:41:08 GMT
[www.browsn.com/sid#2028810799][rid#38808808/initial] (4)
RewriteCond: input='www.browsn.com' pattern='^(?!
(?:api.browsn.com).*)(.+)$' => matched
51.93.164.xx 51.93.164.xx Tue, 08-Nov-2011 12:41:08 GMT
[www.browsn.com/sid#2028810799][rid#38808808/initial] (4)
RewriteCond:
input='/eurl.axd/5ac413b0e6c0654eb2bb597f9c68bf7b/'
pattern='(.+)' => matched
51.93.164.xx 51.93.164.xx Tue, 08-Nov-2011 12:41:08 GMT
[www.browsn.com/sid#2028810799][rid#38808808/initial] (1)
escaping http://www.browsn.com/
51.93.164.xx 51.93.164.xx Tue, 08-Nov-2011 12:41:08 GMT
[www.browsn.com/sid#2028810799][rid#38808808/initial] (2)
explicitly forcing redirect with http://www.browsn.com/
51.93.164.xx 51.93.164.xx Tue, 08-Nov-2011 12:41:08 GMT
[www.browsn.com/sid#2028810799][rid#38808808/initial] (2)
internal redirect with
/eurl.axd/5ac413b0e6c0654eb2bb597f9c68bf7b/ [INTERNAL
REDIRECT]

Thanks for your help
Back to Top
 
pimplic
Newbie


Joined: 22 October 2010
Posts: 19
Posted: 09 November 2011 at 2:37pm

Hi Andrew, any update to the above problem?

thanks for your help.
Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 11 November 2011 at 5:35am

Hello,

I think we need to modify the rule now as in following:

RewriteRule ^([^/]+)/(eurl.axd/.*)$ http(?%1s)://%2/$1 [R=301,L]

and also we need to add an additional rule, hence the rule provided won't work for root:

Code:
RewriteCond %{HTTPS} (on)?
RewriteCond %{HTTP:Host} ^(?!(?:api.browsn.com).*)(.+)$ [NC,OR]
RewriteCond %{HTTP:Host} ^(?!(?:www\.|\d|localhost))(.+)$ [NC]
RewriteCond %{REQUEST_URI} (.+)
RewriteRule ^eurl.axd/.*$ http(?%1s)://%2/ [R=301,L]


Regards
Andrew

Back to Top
 

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

Printable version Printable version