I have built my site to live and all my assets are coming back as 404.
The an example link to the assets is ' http://www.mydomain.co.uk/assets/css/normalize.css ';
I know all my assets live in /web. so when I add /web to the URL and it works, ' http://www.mydomain.co.uk/ {web}/assets/css/normalize.css';
I have added a directory index to my root .htaccess which has helped my site load app.php but this does not seem to work for my assets what am I missing?
// .htaccess DirectoryIndex /web/app.php //
Regards,
To change the document root via .htaccess
add the following to your .htaccess in your server root
RewriteEngine on
RewriteCond %{HTTP_HOST} ^my-domain.co.uk$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.my-domain.co.uk.co.uk$
RewriteCond %{REQUEST_URI} !web/
RewriteRule (.*) /web/$1 [L]
Explained:
RewriteEngine on
//Enable Rewrites
RewriteCond %{HTTP_HOST} ^my-domain.co.uk$ [NC,OR]
//Regex expression that matches people who find your domain without the www.
RewriteCond %{HTTP_HOST} ^www.my-domain.co.uk.co.uk$
//Regex expression that matches another way to your domain
RewriteCond %{REQUEST_URI} !web/
RewriteRule (.*) /web/$1 [L]
// from the root file look for the file which you would like to set as your root mine was www/web - and app.php was in there
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.