Htaccess setup subfolder


#1

Hello,
I’m having a problem with a kirby website on a wedos.com hosting.

The folder structure configured by this webhosting provider is as follows: https://kb.wedos.com/cs/webhosting/samostatne-weby-aliasy.html

I apologise that its only in czech language but this is a really popular provider in czech republic so i think it might be helpful if this gets solved also for other people having the same problem in the future.

Basically if I login to FTP I need to upload all the files into a folder www/domains/mydomain.com/ and it shows up at mydomain.com publicly. This is where i put all the kirby files.

The website shows at mydomain.com but all the links point to mydomain.com/domains/mydomain.com/link

For example $site->homepage()->url() points to mydomain.com/domains/mydomain.com
Panel can be found at mydomain.com/domains/mydomain.com/panel
Content page at mydomain.com/domains/mydomain.com/my-content-page
and so on.

The website is not broken and everything works as it should, just all the links are ugly.

I tried to change the rewrite base in kirby’s .htacess file to / or /domains/mydomain.com but without any success.

The only thing that worked was setting c::set('url', 'http://mydomain.com');
It fixed all the links but now the panel is not reachable, both mydomain.com/panel or mydomain.com/domains/mydomain.com/panel say Invalid panel URL.

Thank you for any advice


#2

Have you tried to set the rewrite base to / while setting the URL like you did.

My assumption is that the .htaccess on the root is causing this problem.


#3

I also think their the root htaccess is going to be the cause :frowning:
I did like you said but this still outputs the Invalid Panel URL message, although the Gui is already like panel’s.


#4

Hm, isn’t there any other way to assign Domains to subfolders than through the .htaccess? Are you using multiple domains on that hosting?


#5

Does that error appear before or after logging in?


#6

Im not using multiple domains right now but i cant guarantuee it will not be the case in the future. Also im not a big expert in .htaccess syntax so i dont know if it can be assigned somehow differently. The actual file used by the hosting is attached in the link in the first post.

And the error page appears before logging in. Even if i add manually /login to the url the error is still there.


#7

@lukasbestle Is this kind of setup supported at all?


#8

The setup is quite similar to the one of the German hosting provider Uberspace, where Kirby works just fine.

What you could try is the following:

  1. In the /www/.htaccess file, delete the [DPI] flags after the first two RewriteRules.
  2. In the /www/domains/mydomain.com/.htaccess file, set RewriteBase /.

Maybe that works. :slight_smile:


#9

@lukasbestle Ah, I didn’t know they have a similar setup. Thanks for your answer.


#10

Oh, sounds promising! I’ll try this as soon as i get back to work computer and tell you if it worked.
Thank you both so far.