Re: easy subdomains with one install (with multiple domains updated)
Posted: Tue Apr 14, 2009 6:41 pm
Well, that´s a lot of job!
Great solution.
Great solution.
Content management as it is meant to be
https://forum.cmsmadesimple.org/
Thanks... not to big to do.. takes me -5 mins to set up... 3 basic steps... 7-8 to be complete from head to toe...viebig wrote: Well, that´s a lot of job!
Great solution.
Code: Select all
{assign var=UA_Google value=''}
{foreach from=$TLDs key=tdlsI item=tdlsIv}
{if $CurrentTLD eq $tdlsI}
{assign var=UAGoogle value=$tdlsIv}
{/if}
{/foreach}
{literal}<__script__ type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</__script>
<__script__ type="text/javascript">
var pageTracker = _gat._getTracker("{/literal}{$UAGoogle|replace:"XX":"-"}{literal}");
pageTracker._initData();
pageTracker._setDomainName(".{/literal}{$MAINdomain}{literal}.{/literal}{$CurrentTLD}{literal}");
pageTracker._trackPageview();
</__script>{/literal}
I can not do what I want using your postsJeremyBASS wrote: Let me know if that clears it up... I probably need to do a new version of the write up... under one, as the subdomain and mulity domains are based on the same ideas but are split in to two posts... I'll see what I can do to make things clear.
Cheers
Jeremy
Code: Select all
Options -Indexes
Options +FollowSymLinks
RewriteEngine On
# Might be needed in a subdirectory
RewriteBase /
# URL Filtering helps stop some hack attempts
#IF the URI contains a "http:"
RewriteCond %{QUERY_STRING} http\: [OR]
#OR if the URI contains a "["
RewriteCond %{QUERY_STRING} \[ [OR]
#OR if the URI contains a "]"
RewriteCond %{QUERY_STRING} \] [OR]
#OR if the URI contains a "<__script__>"
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
#OR script trying to set a PHP GLOBALS variable via URL
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
#OR any script trying to modify a _REQUEST variable via URL
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
RewriteRule ^.*$ - [F,L]
# END Filtering
# CMSMS Rewriting
# Set assume mod_rewrite to true in config.php and clear CMSMS cache
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteCond %{REQUEST_FILENAME} !-d [NC]
RewriteRule ^(.+)$ index.php?lapas=$1 [QSA]
# END CMSMS
Code: Select all
<?php
$config['process_whole_template'] = true;
$config['output_compression'] = false;
$config['root_url'] = 'http://' . $_SERVER['SERVER_NAME'];
if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=='on')
{
$config['root_url'] = str_replace('http','https',$config['root_url']);
}
$config['use_smarty_php_tags'] = false;
#Automatically assign alias based on page title?
$config['auto_alias_content'] = true;
#------------
#URL Settings
#------------
#Show mod_rewrite URLs in the menu? You must enable 'use_hierarchy' for this to work for modules
$config['assume_mod_rewrite'] = true;
#Extension to use if you're using mod_rewrite for pretty URLs.
$config['page_extension'] = '';
$config['internal_pretty_urls'] = false;
$config['use_hierarchy'] = true;
$config['query_var'] = 'lapas';
$config['locale'] = '';
$config['default_encoding'] = '';
$config['admin_encoding'] = 'utf-8';
$config['old_stylesheet'] = false;
?>
I will push the www rule if you use the subdomain... Also ... I don't use the Options +FollowSymLinks thou I'm not sure if it'll make a dif...# example.com to www.example.com force -- to insure URL integrity
RewriteCond %{HTTP_HOST} ^(example\.com)$ [NC]
RewriteRule ^(.*)$ http://www.%1/$1 [R=301,L]
# second domain and page alias for its domain root
RewriteCond %{HTTP_HOST} example\.tdl [NC]
RewriteCond %{REQUEST_URI} ^/$
RewriteRule .* /tdl
# subdomain hanlding for both
RewriteCond %{HTTP_HOST} !^www\.example.tdl
RewriteCond %{REQUEST_URI} ^/$
RewriteCond %{HTTP_HOST} ([^.]+)\.example.tdl
RewriteRule ^(.*)$ %1
Gotcha, eventually. The script in red did the trick. Thank you for your patience and help.JeremyBASS wrote: Mostly... it's your .htaccess file... you'd want to place what I posted in there.. start with the red and add the others as needed...
Cheers
Jeremy