Reputation: 3644
I've developed site using Yii framework. All went well on local machine, but when i deployed it to client's server, i've ran into issue with resource files (css,js,images).
The url for site is something like this: subdomain.domain.com/site
. When i access it, everything works, except that i have no css, js or images. In browser's console i noticed that page is trying to access resources at the wrong place, namely it is looking for subdomain.domain.com/js
(or /css, or /images) instead of subdomain.domain.com/site/js
.
Is there any way to change path used to look for resource files, so that i don't have to change every single link in the project? (I tried changing basePath in config, but it seems like it's not the path i should be changing).
Upvotes: 1
Views: 774
Reputation: 143916
You can try adding some rules to do this, although you should really fix it in the code that generates the content.
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/(js|css|images)/
RewriteCond %{DOCUMENT_ROOT}/site%{REQUEST_URI} -f
RewriteRule ^ /site%{REQUEST_URI} [L]
Upvotes: 3