Changes
From SME Server
Jump to navigation
Jump to search
← Older edit
Newer edit →
Https redirection
(view source)
Revision as of 01:58, 28 April 2011
1,014 bytes added
,
01:58, 28 April 2011
db setting code added
Line 94:
Line 94:
+
====Modified code to use a db setting====
+
+
From http://forums.contribs.org/index.php/topic,47451.msg234224.html#msg234224
+
+
This modifies the original code slightly & needs only one 60redir-ibay custom fragment
+
+
{
+
use esmith::AccountsDB;
+
my $adb = esmith::AccountsDB->open_ro();
+
$OUT = "";
+
+
foreach my $ibay ($adb->ibays)
+
{
+
my %properties = $ibay->props;
+
my $key = $ibay->key;
+
if ($properties{'HTTPSredir'})
+
{
+
if ($properties{'HTTPSredir'} eq 'on')
+
{
+
if ($port ne "443")
+
{
+
$OUT .= " ## Redirect Web Address to Secure Address\n";
+
$OUT .= " RewriteEngine on\n";
+
$OUT .= " RewriteRule ^/$key(/.*|\$) https://%{HTTP_HOST}/$key\$1 [L,R]\n";
+
$OUT .= " ## End Of Redirect\n";
+
}
+
}
+
}
+
}
+
}
+
+
Follow the procedure from the earlier part of this Howto & then issue this db command
+
+
db accounts setprop ibayname HTTPSredir on
===Alternative method using custom template and db commands===
===Alternative method using custom template and db commands===
RayMitchell
624
edits
Navigation menu
Page actions
Page
Discussion
View source
History
Page actions
Page
Discussion
More
Tools
In other languages
Personal tools
English
Log in
Koozali SME Server
Main Page
Welcome
Releases
Testimonials
Documentation
SME Server FAQ
Volunteering
Commercial Support
Recent activities
Dashboard
Recent wiki changes
Recent bug changes
Unread Forum posts
Koozali resources
Contribs
How-To's
Forums
Bugzilla
Mailing Lists
Translations
Download
Koozali SME Server wiki
Wiki statistics
Wiki categories
Wiki Help
Koozali Wiki Help
Tools
Special pages
Printable version
Search