<p>have you been able to solve this? I believe it is your folder structure. Craft CMS has some good <a href="https://craftcms.com/docs/4.x/directory-structure.html" rel="nofollow noreferrer">docs</a> on this.</p>
<p>Personally, when I host Craft sites the structure looks like this. <em>Please note your assets folder can be within your web folder or not, depending on how you have your file connecting in your admin/code.</em></p>
<pre><code>www
|– sitename.com
  |– .htaccess
  |– favicon.ico
  |– index.php (empty from Craft install)
  |– web.config
  |– /assets
    |–  /dist (containing CSS and JS)
    |– /fonts
    |– /images
  |– /cpresources
  |– /web
    |– .env
    |– composer.json
    |– craft
    |– /config
    |– /modules
    |– /path
    |– /storage
    |– /templates
    |– /vendor
</code></pre>
<p>My .htaccess files says the following in my root directory of the website</p>
<pre><code>    &lt;IfModule mod_rewrite.c&gt;
         RewriteEngine On

         # Send would-be 404 requests to Craft
         RewriteCond %{REQUEST_FILENAME} !-f
         RewriteCond %{REQUEST_FILENAME} !-d
         RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]
         RewriteRule (.+) index.php?p=$1 [QSA,L]
     &lt;/IfModule&gt;
</code></pre>
<p>Let me know if this helps or if you have other questions.</p>

CC BY-SA 4.0
2024-01-11T22:56:00.460Z
2024-01-11T22:56:00.460Z
kelly
<p>I've made for the second time a craftCMS website. But is goes wrong at the deployment.
After many times of trying, I got it kinda working when going to siteurl/craftfolder/web.
In that case the content will load without styling.</p>
<p>but I want to load the content with styling at the siteurl, I have some htaccesses and all of that but nothing realy works..
Can anyone help me out..?</p>
<p><a href="https://i.sstatic.net/bf9FR.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/bf9FR.png" alt="This is my folder structure, where www is the root of the webserver" /></a></p>
<p>In my rootfolder I have a site.conf file and an .htaccess</p>
<p><strong>site.conf</strong></p>
<pre><code>&lt;VirtualHost *:80&gt;

    ServerName jbjokido.be
    DocumentRoot &quot;/www/jbjokido.be/web&quot; 

    &lt;Directory &quot;/www/jbjokido.be/web&quot;&gt;
        Order allow,deny
        Allow from all
    &lt;/Directory&gt;
    
&lt;/VirtualHost&gt;
</code></pre>
<p><strong>.htaccess</strong></p>
<pre><code>RewriteEngine on
RewriteCond %{HTTP_HOST} ^jbjokido.be$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.jbjokido.be$
RewriteCond %{REQUEST_URI} !directory/
RewriteRule (.*) /directory/$1 [L]
</code></pre>
<p>Inside the web folder, where my index.php is, is also an .htaccess file</p>
<pre><code>&lt;IfModule mod_rewrite.c&gt;
  RewriteEngine On
  RewriteBase /

  RewriteRule ^jokido/web(.*)$ $1 [L,NC]

  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]
  RewriteRule (.*) index.php?p=$1 [QSA,L]
&lt;/IfModule&gt;
</code></pre>
<p>I hope someone can figure it all out because I'm getting frustrated for not seeing it..</p>

CC BY-SA 4.0
2023-11-12T05:26:21.643Z
Have you defined the craft site URL in either your `.env` file or `general.php` config file?
cherrykoda
<craft4>
I get a 404 not found when going to my site url, but content will show when navigation to url/craftfolder/web
# I get a 404 not found when going to my site url, but content will show when navigation to url/craftfolder/web

(Asked by: username_0 on 2023-11-07)

I've made for the second time a craftCMS website. But is goes wrong at the deployment.
After many times of trying, I got it kinda working when going to siteurl/craftfolder/web.
In that case the content will load without styling.
but I want to load the content with styling at the siteurl, I have some htaccesses and all of that but nothing realy works..
Can anyone help me out..?

In my rootfolder I have a site.conf file and an .htaccess
site.conf


    ServerName jbjokido.be
    DocumentRoot "/www/jbjokido.be/web" 

    
        Order allow,deny
        Allow from all
    
    


.htaccess
RewriteEngine on
RewriteCond %{HTTP_HOST} ^jbjokido.be$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.jbjokido.be$
RewriteCond %{REQUEST_URI} !directory/
RewriteRule (.*) /directory/$1 [L]

Inside the web folder, where my index.php is, is also an .htaccess file

  RewriteEngine On
  RewriteBase /

  RewriteRule ^jokido/web(.*)$ $1 [L,NC]

  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]
  RewriteRule (.*) index.php?p=$1 [QSA,L]


I hope someone can figure it all out because I'm getting frustrated for not seeing it..

**Tags:** craft4
> **Comments:**
> **username_1**: Have you defined the craft site URL in either your `.env` file or `general.php` config file?  

---

## 1 answers

### Answer by username_2 on 2024-01-11. Score: 1

have you been able to solve this? I believe it is your folder structure. Craft CMS has some good docs on this.
Personally, when I host Craft sites the structure looks like this. Please note your assets folder can be within your web folder or not, depending on how you have your file connecting in your admin/code.
www
|– sitename.com
  |– .htaccess
  |– favicon.ico
  |– index.php (empty from Craft install)
  |– web.config
  |– /assets
    |–  /dist (containing CSS and JS)
    |– /fonts
    |– /images
  |– /cpresources
  |– /web
    |– .env
    |– composer.json
    |– craft
    |– /config
    |– /modules
    |– /path
    |– /storage
    |– /templates
    |– /vendor

My .htaccess files says the following in my root directory of the website
    
         RewriteEngine On

         # Send would-be 404 requests to Craft
         RewriteCond %{REQUEST_FILENAME} !-f
         RewriteCond %{REQUEST_FILENAME} !-d
         RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]
         RewriteRule (.+) index.php?p=$1 [QSA,L]
     

Let me know if this helps or if you have other questions.


---

