I have the rewrite rule for codeigniter at my webhost:
RewriteEngine on
RewriteCond $1 !^(index\.php|static|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteRule ^[css|js|fonts](/.*)?$ /static$1 [L]
I have a static folder which I want to have accessed through domain/static/css/Layout.css where codeigniter shouldn't parse at 1st.
I am not a regex expert, therefor I am asking you all for your advise. I would kindly thank you.
The 4th line is not needed.
Try removing 4th line and changing 3rd line to
RewriteRule ^(.*)$ index.php/$1 [L]
Solved it!
Here it is:
RewriteEngine on
RewriteCond %{REQUEST_URI} !/static/
RewriteRule ^(.+)\.(css|img|fonts|js)$ /static/$1 [L]
RewriteCond $1 !^(index\.php|images|robots\.txt|static)
RewriteRule ^(.*)$ /index.php/$1 [L]
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.