Skip to content
Grav 2.1 is out: every page speaks Markdown. Read the announcement →

Subfolder "grav" in url

Solved by thgr View solution

Started by thgr 6 years ago · 1 replies · 1085 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 jeremycherfas, 1 week ago
1 111 7 days ago
Installation & Hosting · by motorambler, 3 weeks ago
8 392 2 weeks ago
Installation & Hosting · by antoinep, 3 months ago
8 963 3 months ago
Installation & Hosting · by Jürgen Dietrich, 10 months ago
0 623 10 months ago
Installation & Hosting · by rappluk, 11 months ago
0 667 11 months ago