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: simple url redirect
Author
Message |
llau
Newbie


Joined: 11 August 2010
Location: Canada
Posts: 7
Posted: 31 August 2010 at 2:28pm

Hi,

I'm using ISAPI Rewrite3 Lite and I'm trying to create a rule for redirection on an IIS6 server:

Code:

# Helicon ISAPI_Rewrite configuration file
# Version 3.1.0.69

RewriteEngine On
RewriteLogLevel 9
RewriteLog "C:\Program Files\Helicon\ISAPI_Rewrite3\Rewrite.log"

########## Begin - Rewrite rules to block out some common exploits
## If you experience problems on your site block out the operations listed below
## This attempts to block the most common type of exploit `attempts` to Joomla!
#
## Deny access to extension xml files (uncomment out to activate)
#<Files ~ "\.xml$">
#Order allow,deny
#Deny from all
#Satisfy all
#</Files>
## End of deny access to extension xml files
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
# Block out any script trying to base64_encode crap to send via URL
RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
# Block out any script that includes a <script> tag in URL
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
# Block out any script trying to set a PHP GLOBALS variable via URL
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
# Block out any script trying to modify a _REQUEST variable via URL
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
# Send all blocked request to homepage with 403 Forbidden error!
RewriteRule ^(.*)$ index.php [F,L]
#

RewriteBase /

########## Begin - Joomla! core SEF Section
#
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/index.php
RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$  [NC]
RewriteRule (.*) index.php
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
#
########## End - Joomla! core SEF Section
RewriteEngine on   
RewriteBase /
# redirection for Vic Coal and Heating website
RewriteCond %{HTTP_HOST} .*mysite.ca
RewriteCond %{HTTP_HOST} !^www\.mysite\.ca
RewriteRule (.*) http://www.mysite.com$1 [R=301,L]



What I'm trying to do is redirect all requests for www.mysite.ca to www.mysite.com, but what I've done doesn't seem to be working.

Thanks very much in advance
Victoria


Edited by llau - 31 August 2010 at 2:52pm
Back to Top Visit llau's Homepage
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 01 September 2010 at 4:25am

Hello Victoria,

I find these two controversial :
Code:
RewriteCond %{HTTP_HOST} .*mysite.ca
RewriteCond %{HTTP_HOST} !^www\.mysite\.ca


As if you're saying apply this rule for mysite.ca, but not mysite.ca.

Please erase the second one. And you may modify the first like

Code:
RewriteCond %{HTTP_HOST} ^(?:www)?\.mysite.ca$ [NC]


Regards
Andrew


Edited by AndrushkaUS - 02 September 2010 at 3:30am
Back to Top
 
llau
Newbie


Joined: 11 August 2010
Location: Canada
Posts: 7
Posted: 01 September 2010 at 4:20pm

Hi Andrew,

Thanks for the tip. I tried changing it like you said above and it didn't seem to work. I checked the log file, and I don't see the pattern being applied for some reason. Should this condition and rule be inserted before the Joomla Core SEF section?

Thanks,
Victoria



Edited by llau - 01 September 2010 at 4:32pm
Back to Top Visit llau's Homepage
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 02 September 2010 at 3:32am

Please, provide the log file to see what's happening.
The reason you haven't seen the condition being applied is that the order of processing is:

- check for the rule to match
- check condition

So if the rule is not matched, you won't see condition check.
OR request was taken by the other rule.

Regards
Andrew
Back to Top
 
llau
Newbie


Joined: 11 August 2010
Location: Canada
Posts: 7
Posted: 03 September 2010 at 1:58pm

Andrew,

Here's the last 15 lines or so of the log file:

Code:

24.69.129.119 24.69.129.119  Fri, 03-Sep-2010  11:04:36 GMT [www.victoriacoalandheating.ca/sid#803932634][rid#19538448/initial] (2) init rewrite engine with requested uri /templates/theme176/images/body-bg.gif
24.69.129.119 24.69.129.119  Fri, 03-Sep-2010  11:04:36 GMT [www.victoriacoalandheating.ca/sid#803932634][rid#19538448/initial] (1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
24.69.129.119 24.69.129.119  Fri, 03-Sep-2010  11:04:36 GMT [www.victoriacoalandheating.ca/sid#803932634][rid#19538448/initial] (3) applying pattern '^(.*)$' to uri 'templates/theme176/images/body-bg.gif'
24.69.129.119 24.69.129.119  Fri, 03-Sep-2010  11:04:36 GMT [www.victoriacoalandheating.ca/sid#803932634][rid#19538448/initial] (4) RewriteCond: input='' pattern='mosConfig_[a-zA-Z_]{1,21}(=|\%3D)' => not-matched
24.69.129.119 24.69.129.119  Fri, 03-Sep-2010  11:04:36 GMT [www.victoriacoalandheating.ca/sid#803932634][rid#19538448/initial] (4) RewriteCond: input='' pattern='base64_encode.*\(.*\)' => not-matched
24.69.129.119 24.69.129.119  Fri, 03-Sep-2010  11:04:36 GMT [www.victoriacoalandheating.ca/sid#803932634][rid#19538448/initial] (4) RewriteCond: input='' pattern='(\<|%3C).*script.*(\>|%3E)' => not-matched
24.69.129.119 24.69.129.119  Fri, 03-Sep-2010  11:04:36 GMT [www.victoriacoalandheating.ca/sid#803932634][rid#19538448/initial] (4) RewriteCond: input='' pattern='GLOBALS(=|\[|\%[0-9A-Z]{0,2})' => not-matched
24.69.129.119 24.69.129.119  Fri, 03-Sep-2010  11:04:36 GMT [www.victoriacoalandheating.ca/sid#803932634][rid#19538448/initial] (4) RewriteCond: input='' pattern='_REQUEST(=|\[|\%[0-9A-Z]{0,2})' => not-matched
24.69.129.119 24.69.129.119  Fri, 03-Sep-2010  11:04:36 GMT [www.victoriacoalandheating.ca/sid#803932634][rid#19538448/initial] (3) applying pattern '(.*)' to uri 'templates/theme176/images/body-bg.gif'
24.69.129.119 24.69.129.119  Fri, 03-Sep-2010  11:04:36 GMT [www.victoriacoalandheating.ca/sid#803932634][rid#19538448/initial] (4) RewriteCond: input='C:/WebRoot/victoria-coal-heating/templates/theme176/images/body-bg.gif' pattern='!-f' => matched
24.69.129.119 24.69.129.119  Fri, 03-Sep-2010  11:04:36 GMT [www.victoriacoalandheating.ca/sid#803932634][rid#19538448/initial] (4) RewriteCond: input='C:/WebRoot/victoria-coal-heating/templates/theme176/images/body-bg.gif' pattern='!-d' => matched
24.69.129.119 24.69.129.119  Fri, 03-Sep-2010  11:04:36 GMT [www.victoriacoalandheating.ca/sid#803932634][rid#19538448/initial] (4) RewriteCond: input='/templates/theme176/images/body-bg.gif' pattern='^/index.php' => matched
24.69.129.119 24.69.129.119  Fri, 03-Sep-2010  11:04:36 GMT [www.victoriacoalandheating.ca/sid#803932634][rid#19538448/initial] (4) RewriteCond: input='/templates/theme176/images/body-bg.gif' pattern='(/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$' => not-matched
24.69.129.119 24.69.129.119  Fri, 03-Sep-2010  11:04:36 GMT [www.victoriacoalandheating.ca/sid#803932634][rid#19538448/initial] (3) applying pattern '.*' to uri 'templates/theme176/images/body-bg.gif'
24.69.129.119 24.69.129.119  Fri, 03-Sep-2010  11:04:36 GMT [www.victoriacoalandheating.ca/sid#803932634][rid#19538448/initial] (1) Rewrite URL to >> /templates/theme176/images/body-bg.gif
24.69.129.119 24.69.129.119  Fri, 03-Sep-2010  11:04:36 GMT [www.victoriacoalandheating.ca/sid#803932634][rid#19538448/initial] (2) rewrite 'templates/theme176/images/body-bg.gif' -> '/templates/theme176/images/body-bg.gif'
24.69.129.119 24.69.129.119  Fri, 03-Sep-2010  11:04:36 GMT [www.victoriacoalandheating.ca/sid#803932634][rid#19538448/initial] (2) internal redirect with /templates/theme176/images/body-bg.gif [INTERNAL REDIRECT]


Thanks
Victoria
Back to Top Visit llau's Homepage
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 06 September 2010 at 3:53am

Well, somehow I do not see 'input' parameter is some cases.
I see it's 69 build. Please upgrate to the latest build.

Regards
Andrew
Back to Top
 
lixiang
Newbie


Joined: 08 September 2010
Posts: 5
Posted: 08 September 2010 at 4:40am

To tell the truth, I agree with the idea of AndrushkaUS's

__________________
MAC Eyeliner Cosmetics
Back to Top Visit lixiang's Homepage
 
llau
Newbie


Joined: 11 August 2010
Location: Canada
Posts: 7
Posted: 19 June 2012 at 4:39pm

I'm using a joomla search module with SEF urls and Helicon ISAPI rewrite on Windows Server 2003 and IIS, and I seem to be having a problem with the search not working.

I get a 404 error.....here's the log, if you look at it it seems like there is another filter being applied to the URL which is preventing the full Joomla search URL from being accepted

Code:

(2) init rewrite engine with requested uri /Rejected-By-UrlScan?~/component/search/%252F
(1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
(3) applying pattern '^(.*)$' to uri 'Rejected-By-UrlScan'
(4) RewriteCond: input='~/component/search/%252F' pattern='mosConfig_[a-zA-Z_]{1,21}(=|\%3D)' => not
(4) RewriteCond: input='~/component/search/%252F' pattern='base64_encode.*\(.*\)' => not-matched
(4) RewriteCond: input='~/component/search/%252F' pattern='(\<|%3C).*script.*(\>|%3E)' => not-matche
(4) RewriteCond: input='~/component/search/%252F' pattern='GLOBALS(=|\[|\%[0-9A-Z]{0,2})' => not-mat
(4) RewriteCond: input='~/component/search/%252F' pattern='_REQUEST(=|\[|\%[0-9A-Z]{0,2})' => not-ma
(3) applying pattern '(.*)' to uri 'Rejected-By-UrlScan'
(4) RewriteCond: input='C:/WebRoot/ombudsperson/Rejected-By-UrlScan' pattern='!-f' => matched
(4) RewriteCond: input='C:/WebRoot/ombudsperson/Rejected-By-UrlScan' pattern='!-d' => matched
(4) RewriteCond: input='/Rejected-By-UrlScan' pattern='^/index.php' => matched
(4) RewriteCond: input='/Rejected-By-UrlScan' pattern='(/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.
(1) Rewrite URL to >> /index.php?~/component/search/%252F
(2) rewrite 'Rejected-By-UrlScan' -> '/index.php?~/component/search/%252F'
(3) applying pattern '.*' to uri 'index.php'
(1) Rewrite URL to >> /index.php?~/component/search/%252F
(2) rewrite 'index.php' -> '/index.php?~/component/search/%252F'
(2) internal redirect with /index.php?~/component/search/%252F [INTERNAL REDIRECT]

(2) init rewrite engine with requested uri /templates/system/css/error.css
(1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
(3) applying pattern '^(.*)$' to uri 'templates/system/css/error.css'
(4) RewriteCond: input='' pattern='mosConfig_[a-zA-Z_]{1,21}(=|\%3D)' => not-matched
(4) RewriteCond: input='' pattern='base64_encode.*\(.*\)' => not-matched
(4) RewriteCond: input='' pattern='(\<|%3C).*script.*(\>|%3E)' => not-matched
(4) RewriteCond: input='' pattern='GLOBALS(=|\[|\%[0-9A-Z]{0,2})' => not-matched
(4) RewriteCond: input='' pattern='_REQUEST(=|\[|\%[0-9A-Z]{0,2})' => not-matched
(3) applying pattern '(.*)' to uri 'templates/system/css/error.css'
(4) RewriteCond: input='C:/WebRoot/ombudsperson/templates/system/css/error.css' pattern='!-f' => not
(3) applying pattern '.*' to uri 'templates/system/css/error.css'
(1) Rewrite URL to >> /templates/system/css/error.css
(2) rewrite 'templates/system/css/error.css' -> '/templates/system/css/error.css'
(2) internal redirect with /templates/system/css/error.css [INTERNAL REDIRECT]

(2) init rewrite engine with requested uri /component/search/?searchword=test&ordering=&searchphrase
(1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
(3) applying pattern '^(.*)$' to uri 'component/search/'
(4) RewriteCond: input='searchword=test&ordering=&searchphrase=all' pattern='mosConfig_[a-zA-Z_]{1,2
(4) RewriteCond: input='searchword=test&ordering=&searchphrase=all' pattern='base64_encode.*\(.*\)'
(4) RewriteCond: input='searchword=test&ordering=&searchphrase=all' pattern='(\<|%3C).*script.*(\>|%
(4) RewriteCond: input='searchword=test&ordering=&searchphrase=all' pattern='GLOBALS(=|\[|\%[0-9A-Z]
(4) RewriteCond: input='searchword=test&ordering=&searchphrase=all' pattern='_REQUEST(=|\[|\%[0-9A-Z
(3) applying pattern '(.*)' to uri 'component/search/'
(4) RewriteCond: input='C:/WebRoot/ombudsperson/component/search/' pattern='!-f' => matched
(4) RewriteCond: input='C:/WebRoot/ombudsperson/component/search/' pattern='!-d' => matched
(4) RewriteCond: input='/component/search/' pattern='^/index.php' => matched
(4) RewriteCond: input='/component/search/' pattern='(/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*
(1) Rewrite URL to >> /index.php?searchword=test&ordering=&searchphrase=all
(2) rewrite 'component/search/' -> '/index.php?searchword=test&ordering=&searchphrase=all'
(3) applying pattern '.*' to uri 'index.php'
(1) Rewrite URL to >> /index.php?searchword=test&ordering=&searchphrase=all
(2) rewrite 'index.php' -> '/index.php?searchword=test&ordering=&searchphrase=all'
(2) internal redirect with /index.php?searchword=test&ordering=&searchphrase=all [INTERNAL REDIRECT]


Back to Top Visit llau's Homepage
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 25 June 2012 at 9:22am

@llau:
Please show the config you currently use, what testing request you make and what result you expect to get.
Where do you see another filter interfering?


__________________
Regards,
Anton
Back to Top
 

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

Printable version Printable version