How to remove string from url or is there any option to have base url?

I have page http://truhlarstvimertl.cz/ where home page is on http://truhlarstvimertl.cz/domains/truhlarstvimertl.cz/. I want to get rid of that “/domains/truhlarstvimertl.cz” string but there is no option like in wordpres to rewrite url.

This is because grav is not installed in root folder but it is in www/domains/truhlarstvimertl.cz/
Also i tried to play with .htacces, but no success.

Hope you understand my problem, it is little bit complicated :slight_smile:

I’m thinking about editing the Uri.php the function buildHostname()

There seems to be one .cz host that has this requirement. It’s come up 3 times now, and only ever for .cz domains with this very specific URL format. No other host we have ever come across has had these issues… Just this one.

As we don’t have an account there, and no real way to test it’s a bit hard for us to quickly replicate and fix the issue. If you can help that would surely be appreciated. A PullRequest with a fix would be awesome!

Thanks for answer. Yea, this provider is wedos.com (from czech rep.) and i hate this format of URL. In wordpress it is solved by changing site URL in administration https://codex.wordpress.org/Changing_The_Site_URL. I don’t really know where to start to write some rules in Grav. Do you have any suggestions or tips how this can be made? I would like to fix this issue, because i fell in love with grav!

This is the solution:
https://github.com/getgrav/grav/issues/783
Change uri.php (system/src/Grav/common/):

From:
$root_path = str_replace(’ ', ‘%20’, rtrim(substr($_SERVER[‘PHP_SELF’], 0, strpos($_SERVER[‘PHP_SELF’], ‘index.php’)), ‘/’));

To:
$root_path = str_replace(’ ', ‘%20’, rtrim(substr($_SERVER[‘REQUEST_URI’], 0, strpos($_SERVER[‘REQUEST_URI’], ‘index.php’)), ‘/’));

I’ve been experimenting allowing such URL rewrites in this PR: https://github.com/getgrav/grav/pull/896.

Would be nice if you can test it on your server.

I have tested it and it works fine, until i try to login.
Repro:

  1. Go to domain.com/admin
  2. Fill your name and password
  3. Hit login

Actual behaviour:
Url looks like this "admin/"
And it throws this error:
405 - HTTP verb used to access this page is not allowed.
Error screen

On the frontend it’s working fine? Just admin gives issues?

Yep