开发者

Rewriting static files in .htaccess

I have application in subfolder http://example.com/some/other/sub/folder/. And .htaccess file:

    RewriteEngine on    
    RewriteBase /some/other/sub/folder
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    R开发者_JAVA百科ewriteRule ^(.*)$ index.php?p=$1 [QSA,L]

Template files contain absolute URL to the images, js and css files: /images/header.png, /js/common.js etc.

My problem is that static files with absolute paths is not accessible.

Thx.


The reason is that with a reference of an absolute URL path /images/header.png you actually reference /images/header.png and not /some/other/sub/folder/images/header.png.

Either use relative URL paths that work with /some/other/sub/folder/ as the base path. Or use absolute URL paths like /some/other/sub/folder/images/header.png that then are independent to the actual base path.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜