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.

Themes & Styling

Access Spesific Folder Via URL

theme

Solved by desta View solution

Started by desta 4 years ago · 7 replies · 680 views
4 years ago

Hi again

I want to using ViewerJS library, but instalation i must access via Url, examples my sites

https://web.persahabatan.co.id/ViewerJS/#../{{ path_file }}

How to handle ViewerJS Folder in my grav site?

like below, it's good?

getgrav-viewerjs|690x269

Thanks.

4 years ago

I believe you should edit .htaccess rules.
Also there's Ignore folders option in system.yaml I think, but not sure what it does

4 years ago

it's must use .htaccess rules? can you provide some details? i'm using apache.

Yes, it's have options ignore_folders but default like

BASH
  ignore_files:
    - .DS_Store
  ignore_folders:
    - .git
    - .idea

btw, ViewerJS inside user folder or in outside userfolder?

4 years ago

In my case i'm using

BASH
<iframe src="{{ base_url_simple }}/ViewerJS/#..{{ url }}" width="100%" height="800"></iframe>

it's working, but... i'm asking for security reason. it's good approach like thats?

4 years ago

Wait, are you using it in the same Grav site? I thought you wanted it to be accessed from outside. So why can't you put it to your theme and use like {{ url('theme://ViewerJS/#..{{ url }}') }}?

4 years ago Solution

Oke, Everthing is done and Running well in Production Server, App Grav Is more secure now! this is my step.

  1. Move Grav App in root folder to subfolder of root, example: grav ~ resource 1, in my case it's like this

subfoler-root|690x364

grav folder is my grav site and ViewerJS is other app need my grav site to operated.

  1. Follow instruction in link before, in resource 1.

  2. Custom .htaccess for you apache config like below ~ resource 2

BASH
<IfModule mod_rewrite.c>

RewriteEngine On
RewriteRule ^(ViewerJS)($|/) - [L]
RewriteCond %{REQUEST_URI} !^/grav/
RewriteRule ^(.*)$ /grav/$1

</IfModule>

# Begin - Prevent Browsing and Set Default Resources
Options -Indexes
DirectoryIndex index.php index.html index.htm
# End - Prevent Browsing and Set Default Resources
  1. Finish, You can acceess your site like normal.

Big thanks to @Karmalakas for long discussion and make me more creative search the problem.

Suggested topics

Topic Participants Replies Views Activity
Themes & Styling · by Pedro M, 2 months ago
4 198 2 months ago
Themes & Styling · by Ian, 2 months ago
3 94 2 months ago
Themes & Styling · by Norbert, 2 years ago
11 455 3 months ago
Themes & Styling · by Lukáš Findeis, 3 months ago
0 48 3 months ago
Themes & Styling · by Sebadamus, 4 months ago
5 128 3 months ago