Add ability to specify alternate domains e.g. dreamwidth.net,
dreamwidth.com which redirect back to the main site domain.
Patch by exor674.
diffs (56 lines):
diff -r 94480661f601 -r 7351b0b64242 cgi-bin/Apache/LiveJournal.pm
--- a/cgi-bin/Apache/LiveJournal.pm Fri Jun 12 17:58:07 2009 +0000
+++ b/cgi-bin/Apache/LiveJournal.pm Fri Jun 12 20:33:03 2009 +0000
@@ -351,6 +351,34 @@ sub trans
my $url = "$LJ::SITEROOT$uri";
$url .= "?" . $args if $args;
return redir($r, $url);
+ }
+
+ # handle alternate domains
+ if ( $host ne $LJ::DOMAIN && $host ne $LJ::DOMAIN_WEB ) {
+ my $which_alternate_domain = undef;
+ foreach my $other_host ( @LJ::ALTERNATE_DOMAINS ) {
+ $which_alternate_domain = $other_host
+ if $host =~ m/\Q$other_host\E$/i;
+ }
+
+ if ( defined $which_alternate_domain ) {
+ my $root = $is_ssl ? "https://" : "http://";
+ $host =~ s/\Q$which_alternate_domain\E$/$LJ::DOMAIN/i;
+
+ # do $LJ::DOMAIN -> $LJ::DOMAIN_WEB here, to save a redirect.
+ if ( $LJ::DOMAIN_WEB && $host eq $LJ::DOMAIN ) {
+ $host = $LJ::DOMAIN_WEB;
+ }
+ $root .= "$host/";
+
+ if ( $r->method eq "GET" ) {
+ my $url = "$root$uri";
+ $url .= "?" . $args if $args;
+ return redir( $r, $url );
+ } else {
+ return redir( $r, $root );
+ }
+ }
}
# check for sysbans on ip address
diff -r 94480661f601 -r 7351b0b64242 doc/config-private.pl.txt
--- a/doc/config-private.pl.txt Fri Jun 12 17:58:07 2009 +0000
+++ b/doc/config-private.pl.txt Fri Jun 12 20:33:03 2009 +0000
@@ -33,6 +33,14 @@
# when an entry is posted; hash instead of array for efficiency
%OFFICIAL_JOURNALS = (
news => 1,
+ );
+
+ # list of alternate domains that point to your site.
+ @ALTERNATE_DOMAINS = (
+ 'ljsite.org',
+ 'ljsite.net',
+ 'ljsite.co.uk',
+ 'ljsite.tld',
);
# configuration/ID for statistics tracker modules which apply to
_______________________________________________
dw-changelog mailing list
[email protected]
http://lists.dwscoalition.org/mailman/listinfo/dw-changelog