1

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

This is my folder structure, where www is the root of the webserver

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

site.conf

<VirtualHost *:80>

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

    <Directory "/www/jbjokido.be/web">
        Order allow,deny
        Allow from all
    </Directory>
    
</VirtualHost>

.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

<IfModule mod_rewrite.c>
  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]
</IfModule>

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

1
  • 1
    Have you defined the craft site URL in either your .env file or general.php config file?
    – cherrykoda
    Commented Nov 12, 2023 at 5:26

1 Answer 1

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

    <IfModule mod_rewrite.c>
         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]
     </IfModule>

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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