Page 1 of 1

Admin can't sign in following .htaccess rewrite to www

Posted: Fri Jan 04, 2019 11:36 am
by MantaPro
Hi - installed 2.2.8 and built the website, during the install of 2,2,8 I tried to avoid having any files in root that may interfere with the install; but I did have to have a php.ini to switch on output buffering and force a PHP limit of 128M (by default my hosting shows a memory limit of -1)

I have built the website using a temporary domain (menwinnion.care), once the website development is completed the filesystem and database will stay put but the domain name that uses it will change to http://www.menwinnioncarehome.co.uk/ (I will of course clear the cache before updating the domain DNS records)

I have NOT updated the DNS records yet, the website is still access via menwinnion.care

Throughout the install and website build, the URL kept reverting to http://menwinnion.care , whereas I normally use a .htaccess rewrite rule to redirect access to http://www etc addresses

I have just (post website build) cleared the cache then implemented this .htaccess rule and the Admin signin no longer works; when I input the user name and password , nothing happens - no error message, no userID not recognised, it simply returns the sign in screen again (also checked the CMSMS Admin log - nothing; no failed signin messages).

If remove the /htaccess rewrite; sign in via http://menwinnion.care/admin/login.php ; clear the cache; then reinstall the .htaccess rewrite enforcing http://www.menwinnion.care/... etc then I can do stuff in the Admin OK and the front end website works OK; but I ought to be able to sign in via http://www.menwinnion.care/admin/login.php

Clearly this is also going to be an issue once the website build is completed and the DNS records are updated so that the website is accessed via its real long term URL http://www.menwinnioncarehome.co.uk/ when I will want to be ableto sign in to the Admin via http://www.menwinnioncarehome/admin/login.php

Seems to me that the Admin user/password seems somehow locked on to the URL; change the URL and the user/password signin stops working - suggestions to fix this CMS config issue ?

Code: Select all


----------------------------------------------

Cms Version: 2.2.8

Installed Modules:

    AdminSearch: 1.0.4
    CGBetterForms: 1.9
    CGCalendar: 2.6
    CGExtensions: 1.61.4
    CGGoogleMaps2: 1.1.1
    CGSimpleSmarty: 2.2.1
    CMSContentManager: 1.1.6
    Captcha: 1.0
    CmsJobManager: 0.1.3
    DesignManager: 1.1.4
    FileManager: 1.6.7
    FilePicker: 1.0.3
    Gallery: 2.3.2
    LISE: 1.3.1
    LISETestimonials: 1.3.1
    LISEVacancies: 1.3.1
    LinkMgr: 2.2.1
    MenuManager: 1.50.3
    MicroTiny: 2.2.2
    ModuleManager: 2.1.4
    Navigator: 1.0.9
    News: 2.51.4
    Search: 1.51.5


Config Information:

    php_memory_limit:
    max_upload_size: 64000000
    url_rewriting: none
    page_extension:
    query_var: page
    auto_alias_content: true
    locale:
    set_names: true
    timezone: Europe/London
    permissive_smarty: false


Php Information:

    phpversion: 7.2.13
    md5_function: On (True)
    json_function: On (True)
    gd_version: 2
    tempnam_function: On (True)
    magic_quotes_runtime: Off (False)
    E_ALL: 22517
    E_STRICT: 0
    E_DEPRECATED: 0
    test_file_timedifference: No time difference found
    test_db_timedifference: No time difference found
    create_dir_and_file: 1
    memory_limit: -1
    max_execution_time: 50000
    register_globals: Off (False)
    output_buffering: 0
    disable_functions:
    open_basedir:
    test_remote_url: Success
    file_uploads: On (True)
    post_max_size: 64M
    upload_max_filesize: 64M
    session_save_path: /tmp/.priv (1733)
    session_use_cookies: On (True)
    xml_function: On (True)
    xmlreader_class: On (True)
    check_ini_set: On (True)
    curl: On


Performance Information:

    allow_browser_cache: On (True)
    browser_cache_expiry: 60
    php_opcache: Off (False)
    smarty_cache: Off (False)
    smarty_compilecheck: Off (False)
    auto_clear_cache_age: On (True)

Server Information:

    Server Software: Apache
    Server Api: cgi-fcgi
    Server Os: Linux 3.16.0-ui18135.21-uiabi1-infong-amd64 On x86_64
    Server Db Type: MySQL (mysqli)
    Server Db Version: 5.5.60
    Server Db Grants: Found a "GRANT ALL" statement that appears to be suitable


Permission Information:

    tmp: /homepages/38/d242029264/htdocs/mentest/tmp (0705)
    tmp_cache: /homepages/38/d242029264/htdocs/mentest/tmp/cache (0705)
    templates_c: /homepages/38/d242029264/htdocs/mentest/tmp/templates_c (0705)
    modules: /homepages/38/d242029264/htdocs/mentest/modules (0705)
    uploads: /homepages/38/d242029264/htdocs/mentest/uploads (0705)
    File Creation Mask (umask): /homepages/38/d242029264/htdocs/mentest/tmp/cache (0705)
    config_file: 0644

----------------------------------------------

Re: Admin can't sign in following .htaccess rewrite to www

Posted: Fri Jan 04, 2019 4:15 pm
by DIGI3
Check to see if there's any urls hardcoded in config.php. They shouldn't be needed anymore, so comment them out if there are.

If it's not that, do your testing again but make sure to use incognito mode in your browser, it could just be browser caching.

If it's not that, after you change the url, try adding the new url as a root_url entry in the config.php file (see https://docs.cmsmadesimple.org/configur ... -reference )

Re: Admin can't sign in following .htaccess rewrite to www

Posted: Fri Jan 04, 2019 8:41 pm
by MantaPro
Thanks for your suggestions and help DIGI3, your last suggest worked !! you are a star !! - thanks

I had already checked config.php; in fact I ran a search on the whole file system to check to see if it was hard coded somewhere - no luck. I also ran a search on a MySQL dump to see if any hard coding there was interfering (at that time I was wondering where CMSMS gets some of its config info from for /admin/systeminfo.php - now I know not the DB; looks like the info comes from $_SERVER which even thought .htaccess was forcing the www. URL, $_SERVER still returned the non www URL (probably a quirk of the hosting company I'm using)

I tried clearing my browser (Firefox) cookies and cache; no luck. Given I had never used Chrome or IE via this domain I tried them too - still no luck.

Tried whilst Sconfig['debug']="TRUE"; although all the DB calls were shown when login.php first loaded; it displayed nothing when submitting the Admin userID and password. (which implied it wasn't failing to find nor authenticate; rather a browser/cache/config issue

So I tried your last suggestion of hardcoding $config['root_url'] = 'http://www.menwinnion.care'; in config.php - that worked !! (and now $_SERVER also shows the full www in all its URLs

Excellent DIGI3 ! thank you so much for your suggestions and for kindly taking the time to help me ;D ;D ;D