【问题标题】:css image links after minify with google tool使用谷歌工具缩小后的css图像链接
【发布时间】:2013-02-05 19:17:49
【问题描述】:

我的 css 文件中的图片链接有问题,顺便说一句,如果这会导致问题,我使用 google minify tool

我在 css 中这样使用图像:

background: url('../images/image.png');

图片没有显示在网站上,因为地址是:

http://domain.com/domain.com/public/images/image.png

正确的链接应该是:

http://domain.com/public/images/image.png

domain.com 是我托管的文件夹,所以它添加了该文件夹,我该如何解决这个问题?

这是 .htaccess 代码:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} !^domain.com$ [NC]
    RewriteRule ^(.*)$ http://domain.com/$1 [L,R=301]
    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    RewriteCond %{REQUEST_URI} ^application.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    #Checks to see if the user is attempting to access a valid file,
    #such as an image or css document, if this isn't true it sends the
    #request to index.php
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond $1 !^(index\.php|images|robots\.txt|css)
    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
    # If we don't have mod_rewrite installed, all 404's
    # can be sent to index.php, and everything works as normal.
    # Submitted by: ElliotHaughin

    ErrorDocument 404 /index.php
</IfModule>

<IfModule mod_expires.c>
    # Enable expirations
    ExpiresActive On

    # My favicon
    ExpiresByType image/x-icon "access plus 1 year”

    # Images
    ExpiresByType image/gif "access plus 7 days"
    ExpiresByType image/png "access plus 7 days"
    ExpiresByType image/jpg "access plus 7 days"
    ExpiresByType image/jpeg "access plus 7 days"

    # CSS
    # ExpiresByType text/css "access plus 7 days"

    # Javascript
    ExpiresByType application/javascript "access plus 7 days"
</IfModule>


<IfModule mod_headers.c>
    Header append Cache-Control "public"
</IfModule>

有什么办法吗?

【问题讨论】:

    标签: html css image hyperlink minify


    【解决方案1】:

    找到解决方案。 在 /min/config.php 添加这一行:

    $min_serveOptions['rewriteCssUris'] = false;
    

    对不起。

    【讨论】:

    • 您应该将此添加到主要问题中,而不是将其作为答案发布。除此之外,您的问题充满了糟糕的语法,几乎难以辨认。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-07-03
    • 2015-04-15
    • 1970-01-01
    • 2014-08-28
    • 1970-01-01
    • 2012-11-06
    • 1970-01-01
    相关资源
    最近更新 更多