Skip to content
● Grav 2.2.19 and 1.7.53.8 are out with security fixes found by Anthropic's OSS Scanner: update your sites. Read more →

Subfolder "grav" in url

Solved by thgr View solution

Started by thgr 6 years ago · 1 replies · 1185 views
6 years ago

Hello,

On my web hosting, I would like that the subfolder "grav" disappear from the URL.

I don’t have access to apache vhost config.

Is it possible with .htaccess in the www folder ? (I didn't succed) or should I move everything to www without subfolder grav ?

Thank you

6 years ago Solution

Hello,

I've found the solution in the documentation Change the site URL. In "Scenario 1, run in the domain root folder"

Grav is installed in http://my_site/grav/ I want it to respond on http://my_site

In grav/user/config/system.yaml, I set

custom_base_url: 'http://my_site'

and set the session path to the (new ?) Grav site path,
session:
path: /
(I don't understand why the path is / and not /grav)

And in the domain root, set the redirect, e.g. with .htaccess:

RewriteEngine On
RewriteCond %{REQUEST_URI} !^/grav/
RewriteRule ^(.*)$ /grav/$1

It works and this is what I was looking for.
But it's not so easy to understand, and http://my_site/grav/ continue to give the pages. So maybe I should find something to complete the configuration. Maybe with the htaccess file.

👍 1

Suggested topics

Topic Participants Replies Views Activity
Installation & Hosting · by David, 7 years ago
3 3310 7 days ago
Installation & Hosting · by David Meissner, 2 weeks ago
3 180 1 week ago
Installation & Hosting · by David Meissner, 2 weeks ago
0 129 2 weeks ago
Installation & Hosting · by Anthony J Cervo, 2 weeks ago
3 187 2 weeks ago
Installation & Hosting · by motorambler, 2 months ago
9 879 1 month ago