| Author |
|
amit26oct Newbie

Joined: 16 June 2011 Location: India
Online Status: Offline Posts: 6
|
| Posted: 16 June 2011 at 12:51am | IP Logged
|
|
|
Hi -
I have a problem redirecting from https to http using
rewrite.
I want only redirect homepage
https://www.mywebsite.co.uk/ to
http://www.mywebsite.co.uk/
just to inform you i am using 2.8 version
When I visit some pages eg.
https://www.mywebsite.co.uk/myaccount
or https://www.mywebsite.co.uk/msc_basket_detail.aspx
it needs to do works fine but if any user visit mywebsite
homepage using SSL (https://www.mywebsite.co.uk)
it needs to redirect from (https://www.mywebsite.co.uk/)
to (http://www.mywebsite.co.uk/)
please advice.
|
| Back to Top |
|
| |
Anton Admin Group

Joined: 30 January 2007 Location: Ukraine
Online Status: Offline Posts: 10520
|
| Posted: 16 June 2011 at 4:15am | IP Logged
|
|
|
The rules should be:
[ISAPI_Rewrite]
RewriteCond %HTTPS .*on.*
RewriteRule / http\://www.mywebsite.co.uk/ [RP]
__________________ Regards,
Anton
|
| Back to Top |
|
| |
amit26oct Newbie

Joined: 16 June 2011 Location: India
Online Status: Offline Posts: 6
|
| Posted: 16 June 2011 at 11:45am | IP Logged
|
|
|
Hi Anton,
Unfortunately, It is not working. rest of the ssl pages works fine. eg.
https://www.mywebsite.co.uk/myaccount
https://www.mywebsite.co.uk/msc_basket_detail.aspx
please advice. Thanks, Amit
|
| Back to Top |
|
| |
Anton Admin Group

Joined: 30 January 2007 Location: Ukraine
Online Status: Offline Posts: 10520
|
| Posted: 17 June 2011 at 4:41am | IP Logged
|
|
|
Do you have any other ISAPI_Rewrite rules working fine for you?
And please try to change the condition as follows:
RewriteCond %HTTPS (?!off).*
__________________ Regards,
Anton
|
| Back to Top |
|
| |
amit26oct Newbie

Joined: 16 June 2011 Location: India
Online Status: Offline Posts: 6
|
| Posted: 17 June 2011 at 5:42am | IP Logged
|
|
|
No I don't have any ISAPI_Rewrite rule which is working
fine.
please find my ini rule sample below:
------------------------------------------------------
# My Account, MPX, PAYG
# this is rule is a generic rule that states that the
following rules are for actual
folders
# All I have added is the ability for those folders to
work in the virtual folders as
well,
# all physical folders and folders set up in iis need to
be put in this rule to be
accesible in the url
RewriteCond host:
(www\.|local\.|mywebsitestaging\.|redesign\.|mystaging\.|
staging\.|^)(.*?)(\:[0-9]+)?
RewriteHeader X-Rewrite-URL: /((?:myaccount)/(.*)) $2|$4
RewriteRule
(/([^/]+))?/((?:includes|msc|usercontrols|adwords|feeds|e
m|insurancedocs|myaccount|pay-as
-you-
go|payg|HealthCheck|mpx|O2MobileUpdate|veriofiledependenc
y|images)/(.*)) /$3 [I,L]
RewriteRule (.*edirectory/iframe\.(?:aspx|html)) $1 [I,L]
RewriteRule (.*(webservices/.*)) /$2 [I,L]
RewriteRule (.*(webservicesV5/.*)) /$2 [I,L]
# Add trailing slash
RewriteCond Host: (.*)
RewriteCond %HTTPS off
RewriteRule ([^.?]+[^.?/]) http\://$1$2/ [I,RP]
RewriteCond %HTTPS (?!off).*
RewriteRule / http\://mywebsitestaging.mywebsite.co.uk/
[RP]
#Product (affiliate) content block
RewriteRule (.*)/product_selector/show/?(.*)?
/products_w.aspx?$2 [I,L]
# WII
RewriteRule (/([^/]+))?/wii/ /wii.html [I,U]
# EMail Marketing Rule - Virtual eo (email offers) folder
RewriteRule (/([^/]+))?/eo/(.*)/ $1/offer/$3/ [I,RP]
# Claim Page
RewriteRule (.*)?/claim([^\html]+) /claim.html [I,RP]
# Site Map
RewriteRule (/([^/]+))?/sitemap\.html /sitemap2.aspx
[I,U]
# Vodafone landing page redirect
RewriteRule (/([^/\?]+))?/vodafone\.aspx
/network/vodafone [I,U]
# SPECIAL SEARCH FOLDERS
#|=======================================================
================================
=======================================
#| EXAMPLE EXPRESSIONS --
#|=======================================================
================================
=======================================
#| (?n#VALUE#:) if Nth element not empty then add
#VALUE#
#| e.g.
#| RewriteRule (/[^/?]+)?/mixnmatch/([^/?]+)?/?(.*)
$1/search.aspx(?2\?mnm=$2:) [I,U]
#| if there is a string after "mixnmatch/" that does not
contain '/' or '?' then rewrite
to search.aspx?mnm=(value after "mixnmatch/")
#| else rewrite to search.aspx
#|=======================================================
================================
=======================================
RewriteRule (/[^/?]+)?/mixnmatch/([^/?]+)?/?(.*)
$1/search.aspx(?2\?mnm=$2:) [I,U]
RewriteRule (/[^/?]+)?/mobile-phone-offer/([^/?]+)?/?(.*)
$1/search.aspx(?2\?mnm=$2:) [I,U]
RewriteRule (/[^/?]+)?/cat/([^/?]+)?/?(.*)
$1/search.aspx(?2\?category=$2:) [I,U]
RewriteRule (/[^/?]+)?/deal/([^/?]+)?/?([^/?]+)?/?
([^/?]+)?/?([^/?]+)?/?(.*)
$1/search.aspx(?2\?product=$2:)(?3&tariffid=$3:)(?
4&cashbackid=$4:)(?5&gift=$5:) [I,U]
RewriteRule (/[^/?]+)?/simonly/([^/?]+)?/?(.*)
$1/search.aspx?category=sim_only
[I,U]
RewriteRule (/[^/?]+)?/offer/([^/?]+)?/?([^/?]+)?/?(.*)
$1/search.aspx(?2\?oc=$2:)(?3&intcid=$3:) [I,U]
RewriteRule
(/[^/?]+)?/phones/(latest|thinnest|lightest|smallest)/
$1/phones/all/$2/
[I,U,RP]
RewriteRule (/[^/?]+)?/phones/([^/?]+)?/?([^/?]+)?/?
$1/search-manufacturer.aspx(?2\?manufacturer=$2:)(?
3&intcid=$3:) [I,U]
RewriteRule (/[^/?]+)?/phones/([^/\?]+)?/?([^/\?]+)?/?
([^/\?]+)?/?
$1/search-manufacturer.aspx(?2\?manufacturer=$2:)(?
3&sort=$3:)(?4&view=$4:) [I,U]
RewriteRule (/([^/\?]+))?/mobile-phone-
reviews/([^/\?]+)?/?\??([^/]+)?#?.*?
/review.aspx\?product=$3(?4&$4:) [I,U]
RewriteRule (/([^/\?]+))?/accessories(/)?
/accessories.aspx [I,U]
RewriteRule (/([^/\?]+))?/aboutus\.html /about-us.aspx
[I,U]
RewriteRule (/([^/\?]+))?/privacypolicy\.html /privacy-
policy.aspx [I,U]
RewriteRule (/([^/\?]+))?/termsandconditions\.html
/terms-and-conditions.aspx [I,U]
RewriteRule (/[^/?]+)?/termsandconditions\.html/([^/?]+)
(.*)
RewriteRule (/([^/\?]+))?/taf\.html /recommend-a-
friend.aspx [I,U]
RewriteRule (/([^/\?]+))?/affiliate\.html /become-an-
affiliate.aspx [I,U]
#New rule for Network terms and Conditions
RewriteRule
(/([^/\?]+))?/vodafonetermsandconditions\.html
/vodafone-terms-and-conditions.aspx [I,U]
RewriteRule (/([^/\?]+))?/Threetermsandconditions\.html
/Three-terms-and-conditions.aspx
[I,U]
RewriteRule (/([^/\?]+))?/O2termsandconditions\.html /O2-
terms-and-conditions.aspx [I,U]
RewriteRule (/([^/\?]+))?/Orangetermsandconditions\.html
/Orange-terms-and-conditions.aspx [I,U]
RewriteRule (/([^/\?]+))?/tmobiletermsandconditions\.html
/TmobTermsAndConditions.aspx
[I,U]
#New rule ends
#Robots.txt file for sitemap auto discovery
RewriteRule (/([^/]+))?/robots\.txt /robots.aspx [I,U]
#Enable cacheing on default.aspx, flawed will redo this
properly (PB 20/07/2007)
#RewriteRule (/([^/]+))?/ /\?trf=$0 [I,U]
# Standard rules
RewriteRule /[^/]+/(.*\.(?:asp|aspx)|$)?(\?.+)? /$1$2
[I,U]
RewriteRule /(.*\.(?:asp|aspx)|$)(\?.+)? /$1$2 [I,U]
#----------- Rewrite header ----------#
# Mix'n'Match
RewriteCond host:
(www\.|local\.|mywebsitestaging\.|redesign\.|mystaging\.|
staging\.|^)(.*?)(\:[0-9]+)?
RewriteHeader X-Rewrite-URL: (/([^/]+))?/mixnmatch/(.*)
$2|$5| [I,L]
# Special Folders
RewriteCond host:
(www\.|local\.|mywebsitestaging\.|redesign\.|mystaging\.|
staging\.|^)(.*?)(\:[0-9]+)?
RewriteHeader X-Rewrite-URL:
(/([^/]+))?/(?:offer|phones|plan|accessories|thumb|phone|
mobile-broadband|mobile-broadban
d-
offer|gift|mixnmatch|freegift|network|search|w3c|btbroadb
and|sitemap|jobs|mobile-broadb
and-info|laptops|cat|deal|special-
offers|sale|clearance|best-sellers|compare-laptops|next
-day-gifts|pink-mobile-phones|o2-bonus-tariffs|12-month-
contracts)/.* $2|$5| [I,L]
# Standard
RewriteCond host:
(www\.|local\.|mywebsitestaging\.|redesign\.|mystaging\.|
staging\.|^)(.*?)(\:[0-9]+)?
RewriteHeader X-Rewrite-URL: (/([^/]+))?/(.*\.
(?:asp|aspx|html)|$)(\?.+)? $2|$5|$6 [O]
-------------------------------------------------------
thanks,
Amit
|
| Back to Top |
|
| |
Anton Admin Group

Joined: 30 January 2007 Location: Ukraine
Online Status: Offline Posts: 10520
|
| Posted: 20 June 2011 at 3:38am | IP Logged
|
|
|
Ok, let's start with a simple testing rule to see if ISAPI_Rewrite operates correctly.
Please put the following at the top of your config:
RewriteRule /test http\://www.google.com [I,RP]
Then make a request to http://www.mywebsite.co.uk/test. You should see the Google page. Please report the results.
__________________ Regards,
Anton
|
| Back to Top |
|
| |
amit26oct Newbie

Joined: 16 June 2011 Location: India
Online Status: Offline Posts: 6
|
| Posted: 23 June 2011 at 11:43am | IP Logged
|
|
|
yes its working fine.
I need that only the home page to be redirect if any user visit https://www.mywebsite.co.uk/ then it redirect to http://www.mywebsite.co.uk
rest of the pages like /myaccount and /basket page must be works on secure ssl mode, means this need not to be redirect to unsecure page.
currently the myaccount and basket pages works fine in my site but if user visit https://www.mywebsite.co.uk/ then in many browsers specifically IE the unsecure page messagebox pops up.
one more thing i want to know how to test secure ssl in development environment.
|
| Back to Top |
|
| |
amit26oct Newbie

Joined: 16 June 2011 Location: India
Online Status: Offline Posts: 6
|
| Posted: 24 June 2011 at 4:02am | IP Logged
|
|
|
Hi, I have tried the below code as recomend by you but it is not working.
#Redirect HTTPS to non-HTTPS RewriteCond %HTTPS (?!off).* RewriteRule / http\://www.dialaphone.co.uk/ [RP]
I think this might be a version issue.
please advice
|
| Back to Top |
|
| |
Anton Admin Group

Joined: 30 January 2007 Location: Ukraine
Online Status: Offline Posts: 10520
|
| Posted: 24 June 2011 at 7:53am | IP Logged
|
|
|
One of the guesses is that you may have Default Document settings set up to add say index.asp.
Please check and report.
And let's try the following rule just for testing purposes:
#Redirect HTTPS to non-HTTPS
RewriteCond %HTTPS (?!off).*
RewriteRule /(?!(?:myaccount|basket)).* http\://www.dialaphone.co.uk/ [RP]
Please request the root of the site with the above rule and tell what the result is.
__________________ Regards,
Anton
|
| Back to Top |
|
| |