Page 2 of 2
Re: Can no longer log into admin panel
Posted: Mon May 08, 2017 8:33 am
by velden
Clear. Then make sure IF you're using url values in config.php that those have the non-www urls defined.
The https rule is used to force visitors to the secure version. Although you've setup everything right, nothing else would be preventing a visitor to use http:// (or perhaps the https setting on content pages does that). Anyway, it shouldn't conflict and if setup you don't have to do it for every content page.
Re: Can no longer log into admin panel
Posted: Mon May 08, 2017 9:19 am
by wmdvanzyl
EVERYTHING IS WORKING NOW. SHORT SUMMARY OF OFFERED ADVICE AT BOTTOM OF THIS POST.
velden wrote:Clear. Then make sure IF you're using url values in config.php that those have the non-www urls defined.
Thanks. I have double checked and i think i have it set up correctly:
Code: Select all
<?php
# CMS Made Simple Configuration File
# Documentation: /doc/CMSMS_config_reference.pdf
#
$config['debug'] = false;
$config['timezone'] = 'Africa/Johannesburg';
$config['dbms'] = 'mysql';
$config['db_hostname'] = 'localhost';
$config['db_username'] = '*****';
$config['db_password'] = '*****';
$config['db_name'] = '*****';
$config['db_prefix'] = 'cms_';
$config['url_rewriting'] = 'mod_rewrite';
$config['root_url'] = 'https://modh.co.za';
$config['permissive_smarty'] = 1;
$config['admin_dir'] = 'admin';
?>
Code: Select all
#
# The following is to enable pretty URLS
#
<IfModule rewrite_module>
RewriteEngine on
RewriteBase /
# +++++ ADD THIS - START +++++
# Link to http(s)://www.website.com then redirect to https://website.com
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
# Force URLs have https instead of http
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# ++++++ ADD THIS - END +++++
# Rewrites urls in the form of /parent/child/grandchild but only rewrites if the requested URL is not a file or directory.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?page=$1 [QSA]
</IfModule>
Thanks to all who offered their experience and knowledge. I love this community.
- Rolf's code for using https and non-www as pasted here is working 100%. Check out his blog https://www.cmscanbesimple.org/blog/set ... ade-simple
- Velden pointed out that the URL's in the config.php must match what you are setting up in .htaccess, for example https://modh.co.za
- Jo Morg offered a neat trick for actually getting in (after logging in), even if it looks like you are not logged in which is something to try (if you are experiencing this)
- Beware loops in your .htaccess file