CMSMS Tweaks
All command here assume we're in the CMSMS directory.
Sources:
- https://www.cmscanbesimple.org/blog/setting-up-ssl-in-cms-made-simple
- http://techstream.org/Web-Development/HTACCESS/WWW-to-Non-WWW-and-Non-WWW-to-WWW-redirect-with-HTACCESS
- https://www.cmscanbesimple.org/blog/force-www-on-all-your-domains-or-not
Setup a stock .htaccess file:
cp doc/htaccess.txt .htaccess
Redirect non-www to www, with HTTPS
Insert the following in your .htaccess file after RewriteBase /:
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Alternate Redirect non-www to www
Insert the following in your .htaccess file after RewriteBase /:
RewriteCond %{HTTP_HOST} !^www\.mydomain\.com
RewriteRule (.*) http://www.mydomain.com/$1 [R=301,L]
Enable SSL:
Insert the following in your CMSMS config.php file:
$config['root_url'] = 'https://www.mydomain.com';
$config['admin_url'] = 'https://www.mydomain.com/admin';
Enable pretty URLS in the config file:
Insert the following in your CMSMS config.php file:
$config['url_rewriting'] = 'mod_rewrite';
$config['page_extension'] = '.html';
Optionally remove favicon:
rm favicon_cms.ico