Change panel url to prevent brute-force

Hi,

i´m not sure if i have read a tutorial about this topic in the past. But i don´t find it anymore.

Is there a posibility to change the panel url? The panel should be available under a custom url. For example:
my.site.com/my-custom-panel-url/login

Does anyone have an idea?

Kind regards
Tobias

1 Like

This is quite simple:

  • method A:
    • change the name of the folder containing the panel from panel to my-custom-panel-url
    • change the rewrite rule for the panel in your .htaccess file
    RewriteRule ^my-custom-panel-url/(.*) my-custom-panel-url/index.php [L]
    
  • method B (even simpler):
    • only change the rewrite rule in your .htaccess file.

code for method A:

RewriteRule ^my-custom-panel-url/(.*) my-custom-panel-url/index.php [L]

code for method B:

RewriteRule ^my-custom-panel-url/(.*) panel/index.php [L]

Not tested, but it should work both.

Mhh… Thanks for the answer, but both variants don´t work for me.

Kirby always redirect to panel/login. So there have to be a php redirect in the panel code.

Is there a kirby provided method to change that? For example in the config.php?

Yes, there is a redirect in /panel/app/panel.php, line 76 ff.

if(!$user or !$user->hasPanelAccess()) {
  if($user) $user->logout();
   go('panel/login');
 }
});

So you would need an additional rewrite rule.

Unfortunately, Kirby does not provide a method for changing the panel URL via config settings.

Change this question into a suggestion?

This works on my local machine:

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

RewriteRule ^panel/login$ my-custom-panel-url/login? [L,R=301]

with the panel in the folder my-custom-panel-url.

1 Like

@jbeyerstedt: Thanks for your help. I tried it a few days ago with a similar setup. The links worked, but i couldn´t save my content. It was the kirby Verion 2.0.6.

Now i tried it again with the version 2.1.0 and it works. I´ve got no plan why it didn´t work a few day ago. Thanks for helping.

Ok. I assumed, that you had the latest Kirby version.
Please keep in mind, that there was a security update recently. V2.1.1 is the latest version.

Yes i know that there was a security update. But my test installation was old… : ) I already have the latest version 2.1.1 on my production systems…