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

Trouble installing grav in subdirectory

Solved by Luap View solution

Started by Luap 6 years ago · 4 replies · 1322 views
6 years ago

I have trouble installing grav in a subdirectory of my server.

I have a static website running on the root level and several test projects running inside a /dev subfolder (static sites as other flat file cms) and one other site running in /my-other-project which also has its own URL.

However, if I go to www.mysite.com/dev/projectname/01 I get the following message in the browser:

The script could not be executed correctly.
Please refer to your error log for details about this error. You find it in your KIS under the item "Administration > YOUR PRODUCT > YOUR PACKAGE > Logfiles". Further information can also be found in our FAQ.

The logfile looks like this (added {…} for privacy):

TXT
{…} [php7:error] {…} {…} [host www.my-other-domain.com] script '/is/htdocs/…/www/my-other-domain.com/wp-login.php' not found or unable to stat
{…} [php7:error] {…} {…} [host www.my-other-domain.com] script '/is/htdocs/…/www/my-other-domain.com/wp-login.php' not found or unable to stat
{…} [core:alert] {…} {…} [host www.my-other-domain.com] /is/htdocs/…/www/dev/cp/01/.htaccess: Options not allowed here

The .htaccess seems to be read, because if I remove it I get the "Internal Server Error" message shown in the doc: https://learn.getgrav.org/16/troubleshooting/htaccess.

What am I getting wrong here?
Can I have a .htaccess file in the grav root or should I only have one in my main root folder?
If yes, how do I allow options?

Thanks in advance!

last edited 04/12/20 by pamtbaau
6 years ago

No in-depth knowledge here, but I've got multiple Grav installs running in multiple subdirectories and in each one I've got the default .htaccess file.

6 years ago

Thanks for pointing that out, but I couldn't find any hint in there. I think, it's more about the .htaccess file.

I noticed that it's saying in the default .htaccess

MARKDOWN
## Begin RewriteBase
# If you are getting 500 or 404 errors on subpages, you may have to uncomment the RewriteBase entry
# You should change the '/' to your appropriate subfolder. For example if you have
# your Grav install at the root of your site '/' should work, else it might be something
# along the lines of: RewriteBase /<your_sub_folder>
##

# RewriteBase /

## End - RewriteBase

So I thought changing

TXT
# RewriteBase /

to

TXT
RewriteBase /dev/projectname/01/

would help, but it doesn't.

6 years ago Solution

I didn't have to change anything in the RewriteBase, just should have watched the logfile more carefully

TXT
{…} [core:alert] {…} {…} [host my-main-domain.com] /is/htdocs/…/www/dev/cp/01/.htaccess: Options not allowed here

Solution

Commented those two lines out and now it works

TXT
# Options -Indexes
# DirectoryIndex index.php index.html index.htm

-Indexes still don't work, so they seem to be covered by another .htaccess

Suggested topics

Topic Participants Replies Views Activity
Installation & Hosting · by antoinep, 19 hours ago
7 72 53 minutes 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 64 1 year ago