<p>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:</p>

<ul>
<li>craft</li>
<li>index.php</li>
<li>.htaccess</li>
</ul>

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

CC BY-SA 3.0
2015-02-22T13:02:33.637Z
Thank you. Now it works as expected. I have absolutely no desire to get myself into .htaccess voodoo.
KSPR
CC BY-SA 3.0
2015-02-21T17:57:23.090Z
2015-02-21T17:57:23.090Z
André Elvan
<p>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.</p>

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

<p>Note that technically the JSON spec <a href="https://stackoverflow.com/questions/244777/can-comments-be-used-in-json">apparently does not allow comments</a>.</p>

CC BY-SA 3.0
2017-08-30T11:07:00.950Z
2017-08-30T11:07:00.950Z
Sandwich
<p>When I edit the homepage in the cp I get a error 403.</p>

<p>But only on the homepage. Very weird. The Error is:</p>

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

<p>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.</p>

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

<pre><code>- .htaccess {# points to public #}
- craft
- public
-- .htaccess
</code></pre>

<p>In the root htaccess I wrote:</p>

<pre><code>    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]
</code></pre>

<p>And then in <code>/public/.htaccess</code> I wrote:</p>

<pre><code>&lt;IfModule mod_rewrite.c&gt;
    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]


&lt;/IfModule&gt;
</code></pre>

<p>And in <code>/public/index.php</code> there is <code>$craftPath = '../craft';</code></p>

<p>Is there something strange in there? I have no idea about htacces.</p>

<htaccess>
403 when editing the Homepage
# 403 when editing the Homepage

(Asked by: username_0 on 2015-02-21)

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:

    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]




And in /public/index.php there is $craftPath = '../craft';
Is there something strange in there? I have no idea about htacces.

**Tags:** htaccess


---

## 2 answers

### Answer by username_1 on 2015-02-21. Score: 3 | Accepted answer

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).

> **Comments:**
> **username_0**: Thank you. Now it works as expected. I have absolutely no desire to get myself into .htaccess voodoo.  

---

### Answer by username_2 on 2017-08-30. Score: 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](https://stackoverflow.com/questions/244777/can-comments-be-used-in-json).


---

