<p>I'm on a Windows 10 environment with WAMP installed and I had exactly the same problem. Front End failed. Back End worked fine. News links failed. Clicking on website name link from the Localhost screen reveals directory contents. No matter how many times I kept clean installing Craft and tweaking and adding .htaccess files, the problem remained.</p>

<p>I solved the problem in the following way, without the need to add any .htaccess files. It's best to do a complete clean install of Craft.</p>

<p>You'll need the original, untouched, <strong>craft</strong> and <strong>public</strong> folders. Apologies if these following points go over what you already know.</p>

<ol>
<li>Copy the <strong>craft</strong> and <strong>public</strong> folders into the wamp/www/sitename folder as normal (or the Mac equivalent)</li>
<li>Remove all the files from the <strong>public</strong> folder and place them at the base level (i.e. same level as the <strong>craft</strong> folder)</li>
<li>Delete the <strong>public</strong> folder.</li>
<li>Rename the root <strong>htaccess</strong> file to <strong>.htaccess</strong> </li>
<li><p>Open up the <strong>.htaccess</strong> file and add this line </p>

<p>RewriteBase /</p>

<p>after this line</p>

<p>RewriteEngine On</p></li>
<li><p>In the root index.php file change line 4 to <em>$craftPath = './craft';</em></p></li>
<li>Create your localhost database.</li>
<li>Set up your database connection details within craft/config/db.php.</li>
<li>Via your browser, enter localhost/<em>sitename</em>/index.php/admin/install </li>
<li>Click on the <strong>Begin</strong> button.</li>
<li><strong>Create your account</strong> page, fill out as normal.</li>
<li>When you get to the <strong>Setup your site</strong> page, complete the <strong>Site URL</strong> details like this:</li>
</ol>

<p><a href="http://localhost/" rel="nofollow">http://localhost/</a><em>sitename</em></p>

<p>Finish off the install as normal and when your dashboard gets displayed, click on the Website name (top left) to go to the Front End and it will work. Click on the News link and it will work. As will Live Preview. Go to the Localhost page, click on the website name and you will go to your home page instead of having directory details displayed. Finally, if you upload this whole website to your live site it will still work.</p>

<p>Hope this helps someone.</p>

<p>As a slight caveat, I have only been testing Craft for a couple of days and installing it is about as far as I have got to at the moment. So if I've broken Craft no-no's like 'never delete the <strong>public</strong> folder, then I apologise (obviously, it doesn't have to be deleted and just remain empty)</p>

CC BY-SA 4.0
2019-09-07T16:02:25.007Z
This is a good answer, I've used it a few times, and I'm pretty sure this was the recommended install method for Craft 2, but, yes, the Craft community will call you mean names if you move the `public` files into your equivalent public directory.
David Rhoden
CC BY-SA 3.0
2016-07-09T22:24:27.400Z
2016-07-11T01:54:29.763Z
2016-07-11T01:54:29.763Z
Crafty Cockney
<p>The web root needs to be set to the <code>public/</code> folder. All of the other folders can reside outside of the webroot.</p>

<p>Or, you could add a <code>.htaccess</code> file to the <code>craft/</code> folder with this in it</p>

<pre><code>RewriteEngine on
RewriteCond %{REQUEST_URI}::$1 ^(.*?/)(.*)::\2$
RewriteRule ^(.*)$ - [E=BASE:%1]
RewriteCond %{REQUEST_URI}      !^/%{ENV:BASE}public/
RewriteCond %{REQUEST_URI}      !^%{ENV:BASE}public/
RewriteRule ^(.*)$              %{ENV:BASE}public/$1 [L]
</code></pre>

<p>And a <code>.htaccess</code> file to the public folder with...</p>

<pre><code>RewriteEngine on
RewriteCond %{REQUEST_URI}::$1 ^(.*?/)(.*)::\2$
RewriteRule ^(.*)$ - [E=BASE:%1]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ %{ENV:BASE}index.php [L]
</code></pre>

<p>And that <em>should</em> let you access the website via just <a href="http://localhost:8888/craft/" rel="nofollow">http://localhost:8888/craft/</a>. I do this with my local dev sites but I rename the craft folder to match the domain.</p>

CC BY-SA 3.0
2015-09-09T04:50:16.043Z
Note that `/public/` still shows up while in the control panel, but shouldn't on the frontend of the site. And of course drop back to using a normal `.htaccess` file when deploying.
Rick
CC BY-SA 3.0
2015-09-10T00:50:58.597Z
Thanks Rick. I did not have the public folder as the root and once I changed this it resolved itself.
bsmity
CC BY-SA 3.0
2015-09-09T04:49:22.150Z
2015-09-09T04:49:22.150Z
Rick
<p>I have installed Craft successfully on a local Mac environment using Mamp. I can access the admin area and the default homepage when I go to this address <code>localhost:8888/craft/public/</code> but I cannot access the site when I go to this address <code>localhost:8888/craft/</code> Also, when I click on the news link on the default homepage it is a broken link unless I include the public in the URL. </p>

<p><code>localhost:8888/craft/news/2015/we-just-installed-craft</code></p>

<p><code>localhost:8888/craft/public/news/2015/we-just-installed-craft</code></p>

<p>How do I get around the public folder dilemma? 
Thanks in advance.</p>

CC BY-SA 3.0
2015-09-09T04:54:57.050Z
What is your document root folder set to in MAMP? It should be set to that public folder.
Mark Busnelli Jr
<install>
Public folder confusion
# Public folder confusion

(Asked by: username_0 on 2015-09-09)

I have installed Craft successfully on a local Mac environment using Mamp. I can access the admin area and the default homepage when I go to this address `localhost:8888/craft/public/` but I cannot access the site when I go to this address `localhost:8888/craft/` Also, when I click on the news link on the default homepage it is a broken link unless I include the public in the URL.

`localhost:8888/craft/news/2015/we-just-installed-craft`

`localhost:8888/craft/public/news/2015/we-just-installed-craft`

How do I get around the public folder dilemma?
Thanks in advance.

**Tags:** install

> **Comments:**
> **username_1**: What is your document root folder set to in MAMP? It should be set to that public folder.  

---

## 2 answers

### Answer by username_2 on 2016-07-09. Score: 4

I'm on a Windows 10 environment with WAMP installed and I had exactly the same problem. Front End failed. Back End worked fine. News links failed. Clicking on website name link from the Localhost screen reveals directory contents. No matter how many times I kept clean installing Craft and tweaking and adding .htaccess files, the problem remained.

I solved the problem in the following way, without the need to add any .htaccess files. It's best to do a complete clean install of Craft.

You'll need the original, untouched, **craft** and **public** folders. Apologies if these following points go over what you already know.

1. Copy the **craft** and **public** folders into the wamp/www/sitename folder as normal (or the Mac equivalent)
2. Remove all the files from the **public** folder and place them at the base level (i.e. same level as the **craft** folder)
3. Delete the **public** folder.
4. Rename the root **htaccess** file to **.htaccess**
5. Open up the **.htaccess** file and add this line

   RewriteBase /

   after this line

   RewriteEngine On
6. In the root index.php file change line 4 to *$craftPath = './craft';*
7. Create your localhost database.
8. Set up your database connection details within craft/config/db.php.
9. Via your browser, enter localhost/*sitename*/index.php/admin/install
10. Click on the **Begin** button.
11. **Create your account** page, fill out as normal.
12. When you get to the **Setup your site** page, complete the **Site URL** details like this:

<http://localhost/>*sitename*

Finish off the install as normal and when your dashboard gets displayed, click on the Website name (top left) to go to the Front End and it will work. Click on the News link and it will work. As will Live Preview. Go to the Localhost page, click on the website name and you will go to your home page instead of having directory details displayed. Finally, if you upload this whole website to your live site it will still work.

Hope this helps someone.

As a slight caveat, I have only been testing Craft for a couple of days and installing it is about as far as I have got to at the moment. So if I've broken Craft no-no's like 'never delete the **public** folder, then I apologise (obviously, it doesn't have to be deleted and just remain empty)

> **Comments:**
> **username_3**: This is a good answer, I've used it a few times, and I'm pretty sure this was the recommended install method for Craft 2, but, yes, the Craft community will call you mean names if you move the `public` files into your equivalent public directory.  

---

### Answer by username_4 on 2015-09-09. Score: 2

The web root needs to be set to the public/ folder. All of the other folders can reside outside of the webroot.
Or, you could add a .htaccess file to the craft/ folder with this in it
RewriteEngine on
RewriteCond %{REQUEST_URI}::$1 ^(.*?/)(.*)::\2$
RewriteRule ^(.*)$ - [E=BASE:%1]
RewriteCond %{REQUEST_URI}      !^/%{ENV:BASE}public/
RewriteCond %{REQUEST_URI}      !^%{ENV:BASE}public/
RewriteRule ^(.*)$              %{ENV:BASE}public/$1 [L]

And a .htaccess file to the public folder with...
RewriteEngine on
RewriteCond %{REQUEST_URI}::$1 ^(.*?/)(.*)::\2$
RewriteRule ^(.*)$ - [E=BASE:%1]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ %{ENV:BASE}index.php [L]

And that should let you access the website via just http://localhost:8888/craft/. I do this with my local dev sites but I rename the craft folder to match the domain.

> **Comments:**
> **username_4**: Note that `/public/` still shows up while in the control panel, but shouldn't on the frontend of the site. And of course drop back to using a normal `.htaccess` file when deploying.  
> **username_0**: Thanks username_4. I did not have the public folder as the root and once I changed this it resolved itself.  

---

