Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Installation & Hosting

Subfolder "grav" in url

Solved by thgr View solution

Started by thgr 6 years ago · 1 replies · 918 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 antoinep, 22 hours ago
7 73 4 hours ago
Installation & Hosting · by Jürgen Dietrich, 7 months ago
0 65 7 months ago
Installation & Hosting · by rappluk, 8 months ago
0 65 8 months ago
Installation & Hosting · by N, 12 months ago
3 76 12 months ago
Installation & Hosting · by Youle, 1 year ago
1 65 1 year ago