嘿,我一直试图在页面背景上显示图像,但不起作用,我一直收到错误
Resource interpreted as Image but transferred with MIME type text/html:
"http://killerducky1.x10.mx/images/offline.png". killerducky1.x10.mx/:1
关于谷歌chrome dev concole
从外观上看,它是从的第一行开始的
<html>
我到处找了找,除了检查文件是否存在和是否使用之外,找不到修复方法
但我确实发现了一些东西,说.httaccess与它有关,所以我不确定它的原因,因为我为它添加了离线/维护功能
.ht访问
# -FrontPage-
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /profile.php?username=$1
IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
### Maintenance Mode ###
RewriteCond %{REQUEST_URI} !^/(offline'.php|images/offline'.png)$
RewriteRule ^(.*)$ offline'.php [L]
### end of Maintenance Mode ###
<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName killerducky1.x10.mx
AuthUserFile /home/killerdu/public_html/_vti_pvt/service.pwd
AuthGroupFile /home/killerdu/public_html/_vti_pvt/service.grp
offline.php
<html>
<head>
<title>We are offline !</title>
</head>
<body>
<style>
body {
background-image: url('images/offline.png');
background-color: #eee;
background-repeat: no-repeat;
background-attachment: fixed;
background-position: center;
background-size: 1387px 729px;
}
</style>
</body>
</html>
您的问题在这一行:
RewriteCond %{REQUEST_URI} !^/offline'.php$
RewriteRule ^(.*)$ offline'.php [L]
以上告诉任何不以/offline.php
开始的内容都将重定向到包括图像的offline.php
。
你可以通过将其更改为:来修复它
RewriteCond %{REQUEST_URI} !^/(offline'.php|images/offline'.png)$
RewriteRule ^(.*)$ offline'.php [L]