1

When I edit the homepage in the cp I get a error 403.

But only on the homepage. Very weird. The Error is:

You don't have permission to access /public/admin/entries/homepage/2-homepage on this server.

That is totaly the wrong path so I guess it must be a .htaccess problem. It's on a server where I have not much rights.

I couldn't point the url above the webroot to /public/ so I wrote (or better yet pasted) a htaccess in the webroot to redirect into /public/ and I guess thats the problem:

- .htaccess {# points to public #}
- craft
- public
-- .htaccess

In the root htaccess I wrote:

    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^domain.com$ [NC,OR]
    RewriteCond %{HTTP_HOST} ^www.domain.com$
    RewriteCond %{REQUEST_URI} !public/
    RewriteRule (.*) /public/$1 [L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^([^\.]+)$ $1.html [NC,L]

And then in /public/.htaccess I wrote:

<IfModule mod_rewrite.c>
    RewriteEngine On

    # Remove file extensions on hostfactory
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)\.html$ /$1 [L,R=301] 

    # Send would-be 404 requests to Craft
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule (.+) index.php?p=$1 [QSA,L]

  RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
  RewriteRule ^(.*)$ http://%1%{REQUEST_URI} [R=301,QSA,NC,L]


</IfModule>

And in /public/index.php there is $craftPath = '../craft';

Is there something strange in there? I have no idea about htacces.

0
3

If I understand this correctly, you can't put the /craft folder above the public root, so you put both /craft and /public inside public root? That's no point, and you need a lot more .htaccess vodoo to get that sorted out. But, if the craft folder has to stay inside the public webroot, you should just move it there, and not have an additional /public folder inside it. Your setup should look like this:

  • craft
  • index.php
  • .htaccess

In your /public/index.php file you the path to craft to $craftPath = './craft'; and use the default .htaccess file that comes with Craft (or a more complex one).

1
  • 1
    Thank you. Now it works as expected. I have absolutely no desire to get myself into .htaccess voodoo.
    – KSPR
    Feb 22 '15 at 13:02
1

For what it's worth, I had a completely different cause resulting in nearly-identical outcomes. For a site I had just started to get going, I found at one point that the Homepage entry simply would not load for editing. It showed up in the frontend with the default content, but the backend Edit Entry page utterly refused to load.

Turns out that when testing Redactor configurations, I had /* bulk-commented */ out a section of the .json code (in /craft/config/redactor/[test config name].json), which was causing the problem. Inline comments (// this is an inline comment) seemed to be acceptable in practice and wouldn't cause the issue.

Note that technically the JSON spec apparently does not allow comments.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.