Localhost install is fine. Unable to log into panel on hosted install

Hey there gang,

I’ve looked through the docs and forums and haven’t yet found a solution to the problem I’m facing. I’ve also emailed into the support address, but no reply yet as of yesterday morning.

So, I’ve been developing a Kirby-based site via localhost, and that’s working great.

I recently uploaded it to my hosting (Media Temple) and, whilst the front-end works nicely, I cannot make any ground with logging into the back-end panel.

  • I’ve updated to the newest version of Kirby.
  • I’ve updated my hosting to PHP7
  • I’ve added the temporary line c::set('panel.install', true); in the config.php, set up the first user account, and have since deleted the line (as per the docs)
  • I’ve made sure .htaccess is being read
    • RewriteBase / is present
  • I’ve tried to log into the panel:
    • sometimes it will let me log in, though clicking any subsequent panel link will log me out again

    • sometimes it refreshes the panel login with no error message

    • most of the time it gives me the following generic error:

      This page isn’t working
      www.iamglynnsmith.com redirected you too many times.
      Try clearing your cookies.
      ERR_TOO_MANY_REDIRECTS

Clearing my cookies doesn’t have any effect.

I’d really appreciate any help anyone can offer with this. Many thanks.

Could you try with a custom session fingerprint in your config?

 s::$fingerprint = function() {
        return sha1(
            kirby()->roots()->index().
            visitor::ip()
        );
    };

Thanks for the reply!

I’ve added that to my site/config/config.php and I’m still getting the “too many redirects” error when attempting login.

Can you give a little more info about your server. I currently run several Kirby sites on both MT Grid and MT DV without any issue. Have you changed anything outside of the default server settings?

Sure. I’ll provide whatever info is needed, no problem (I just don’t know what info would be relevant). I’m on MT Grid right now. I’m using Cloudflare as a CDN.

I’ve changed nothing outside of the default server settings, no, other than upgrading the PHP version to 7 (it suggests this in Kirby docs).

Cheers.

Try commenting out RewriteBase / by starting the line with a #:

# RewriteBase /

I dont have that set on any of my MT sites.

Yeah, that’s something I added once I’d found the hosted install’s panel wasn’t letting me log in properly. It doesn’t seem to have any effect, and throws the redirect error still.

Cheers.

I take it this just a standard default Kirby .htaccess? can you post everything you have in that file on here so we can see?

Just had an idea. Did you set file permissions correctly? when you login it records some information in a hidden file in the accounts folder. If it cant write to the folder or file, it will barf.

Yeah, no probs. I’ve added to the default: stuff for caching, GZIP’ing, and disabling ETAGs:

## EXPIRES CACHING ##
<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresDefault "access plus 1 year"
  ExpiresByType image/jpg "access plus 1 year"
  ExpiresByType image/jpeg "access plus 1 year"
  ExpiresByType image/gif "access plus 1 year"
  ExpiresByType image/png "access plus 1 year"
  ExpiresByType text/css "access plus 1 month"
  ExpiresByType text/html "access plus 1 month"
  ExpiresByType text/javascript "access plus 1 year"
  ExpiresByType application/javascript "access plus 25 years"
  ExpiresByType application/x-javascript "access plus 1 year"
  ExpiresByType application/pdf "access plus 1 month"
  ExpiresByType application/x-shockwave-flash "access plus 1 month"
  ExpiresByType image/x-icon "access plus 1 year"
</IfModule>

<IfModule mod_headers.c>
  Header append Cache-Control "public"
</IfModule>
## EXPIRES CACHING ##

# ========================== #

# KIRBY DEFAULT RULES
# Kirby .htaccess

# rewrite rules
<IfModule mod_rewrite.c>

# enable awesome urls. i.e.:
# http://yourdomain.com/about-us/team
RewriteEngine on

# make sure to set the RewriteBase correctly
# if you are running the site in a subfolder.
# Otherwise links or the entire site will break.
#
# If your homepage is http://yourdomain.com/mysite
# Set the RewriteBase to:
#
# RewriteBase /mysite

# In some enviroments it's necessary to
# set the RewriteBase to:
#
# RewriteBase /

# block text files in the content folder from being accessed directly
RewriteRule ^content/(.*)\.(txt|md|mdown)$ index.php [L]

# block all files in the site folder from being accessed directly
# except for requests to plugin assets files
#RewriteRule ^assets/plugins/([a-zA-Z0-9\.\-_%=]+)/(.*)$ site/plugins/$1/assets/$2 [L,N]
#RewriteCond $1 !^plugins/[a-zA-Z0-9\.\-_%=]+/assets/.*
RewriteRule ^site/(.*) index.php [L]

# block direct access to kirby and the panel sources
RewriteRule ^(kirby|panel\/app|panel\/tests)/(.*) index.php [L]

# make panel links work
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^panel/(.*) panel/index.php [L]

# make site links work
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php [L]

</IfModule>

# Additional recommended values
# Remove comments for those you want to use.
#
# AddDefaultCharset UTF-8
#
# php_flag short_open_tag on
# KIRBY RULES END #

# ========================== #

# GZIP
<IfModule mod_deflate.c>
  # Compress HTML, CSS, JavaScript, Text, XML and fonts
  AddOutputFilterByType DEFLATE application/javascript
  AddOutputFilterByType DEFLATE application/rss+xml
  AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
  AddOutputFilterByType DEFLATE application/x-font
  AddOutputFilterByType DEFLATE application/x-font-opentype
  AddOutputFilterByType DEFLATE application/x-font-otf
  AddOutputFilterByType DEFLATE application/x-font-truetype
  AddOutputFilterByType DEFLATE application/x-font-ttf
  AddOutputFilterByType DEFLATE application/x-javascript
  AddOutputFilterByType DEFLATE application/xhtml+xml
  AddOutputFilterByType DEFLATE application/xml
  AddOutputFilterByType DEFLATE font/opentype
  AddOutputFilterByType DEFLATE font/otf
  AddOutputFilterByType DEFLATE font/ttf
  AddOutputFilterByType DEFLATE image/svg+xml
  AddOutputFilterByType DEFLATE image/x-icon
  AddOutputFilterByType DEFLATE text/css
  AddOutputFilterByType DEFLATE text/html
  AddOutputFilterByType DEFLATE text/javascript
  AddOutputFilterByType DEFLATE text/plain
  AddOutputFilterByType DEFLATE text/xml

  # Remove browser bugs (only needed for really old browsers)
  BrowserMatch ^Mozilla/4 gzip-only-text/html
  BrowserMatch ^Mozilla/4\.0[678] no-gzip
  BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
  Header append Vary User-Agent
</IfModule>
# END GZIP

# ========================== #

# Disable ETags (using CDN)
Header unset ETag
FileETag None

Thanks for taking a look.

Yeah. I’ve made sure everything is writable. Didn’t seem to help any!

Order is important in .htaccess. Start again with a vanilla copy of Kirbies .htacess and add all your gzip and expires stuff after it. Your Gzip rules are a little old school as well. I had issues with that style of gzip a few years back on MT.

Go with the rules for Gzip and expiry headers described in the HTML5Boilerplate. I know they work.

Ok. Solid advice. Will report back.

Thanks very much :slight_smile:

Ok. I’ve gone back and replaced the entire .htaccess with the default Kirby code, and it’s still giving me the redirect error.

I’m starting to wonder if the problem lies elsewhere…

Are you absolutely sure about those file permissions?

Humour me: delete the entire site from the server. Zip archive the contents of your local public folder, and transfer that via MTs control panel. Theres a file manger in the control panel. Unpack the file on the server using MTs control panel. This should write the files to the server with all the proper permissions and user groups. See if that helps.

Pro tip: if your on a mac, the zip file created will include hidden mac junk. (.DS_Store files etc). Run it through ZipCleaner before you upload. It will strip these out. You don’t want these files on your live web server.

Also is your local server running PHP 7? If your local is running PHP 5.x or something, that may cause issue.

If the above doesn’t work, try doing a manual update of Kirby.

All good ideas :slight_smile:

I did you one better. I took the unedited Kirby Starter Kit and uploaded that.

Still too many redirects!

Server is set to PHP7. It seemed to work “better” when set to it’s default of PHP5.x though. Very odd.

Edit: Relevant permissions were all set to 755
Edit 2: Am using Window 7.

Well this is a strange one. Im out of ideas. You could try creating a subdomain and uploading the Kirby starter kit to that. This would set default server settings for the subdomain. If it works there, then somethings screwy with your main domain. I would have a chat with MT support at that point.

Thanks for all your suggestions, jimbobrjames. Really appreciate it :slight_smile:

But, still no dice.

I’ve pushed my hosting’s PHP version back to 5.6.21, which allows me to log into the root of the dashboard, but again, clicking any further link logs me back out.

I’ve been in contact with the MT support and they’ve suggested it sounds like a PHP session issue, which would be something I’d have to sort out with Kirby.

Any ideas on how I might investigate this?

Thanks all.

Had a feeling something else was at play, so I went ahead and completely disabled Cloudflare as my CDN, even though I’d turned off my site rules and activated Developer Mode.

It all seems to be working.

crossing fingers so hard they’re now a pretzel

Many, many thanks for the suggestions, guys.