Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
“错误”;键入text/html,不是text/css“;通过.htaccess将用户重定向到网页时_Html_Css_Apache_.htaccess - Fatal编程技术网

“错误”;键入text/html,不是text/css“;通过.htaccess将用户重定向到网页时

“错误”;键入text/html,不是text/css“;通过.htaccess将用户重定向到网页时,html,css,apache,.htaccess,Html,Css,Apache,.htaccess,我有一个在apache服务器上运行的网站。 我已经创建了一个新页面(mantenimiento.php),以便在部署到生产环境时自动重定向那里的用户 我已将以下代码添加到.htaccess: RewriteEngine on #RewriteCond %{REQUEST_URI} !/mantenimiento.php$ #RewriteCond %{REMOTE_ADDR} !^x.xxx.xxx.xxx //my public ip #RewriteRule $ /mantenimiento

我有一个在apache服务器上运行的网站。 我已经创建了一个新页面(mantenimiento.php),以便在部署到生产环境时自动重定向那里的用户

我已将以下代码添加到.htaccess:

RewriteEngine on
#RewriteCond %{REQUEST_URI} !/mantenimiento.php$
#RewriteCond %{REMOTE_ADDR} !^x.xxx.xxx.xxx //my public ip
#RewriteRule $ /mantenimiento.php [R=302,L]
(我不熟悉使用重写规则)

我已经指定了我的ip,以便可以使用该页面。 其他用户应该看到mantenimiento.php页面

但是,当使用Tor等匿名浏览器访问网站时,我看到错误:

The stylesheet <my-site-web> was not loaded because its MIME type, "text/html", is not "text/css".
未加载样式表,因为其MIME类型“text/html”不是“text/css”。

不会上载样式和图像

我认为.htaccess中附加的部分导致此操作失败。 如果我对.htaccess的行进行注释,则正确加载样式

如何加载样式和图像


提前感谢

您需要从新规则中排除
js/css/images

重新编写引擎打开
重写cond%{REQUEST_URI}/mantenimiento\.php$[NC]
重写cond%{REMOTE_ADDR}^x、 xxx.xxx.xxx
重写规则!\。(css | js | png | jpe?g | gif | ico)$/mantenimiento.php[R=302,L,NC]
否则,web浏览器将尝试将
/mantenimiento.php
的输出呈现为css或图像资源