Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.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
Apache 为什么retina shauniman.htaccess代码不能在服务器上运行,以及如何修复它?_Apache_.htaccess - Fatal编程技术网

Apache 为什么retina shauniman.htaccess代码不能在服务器上运行,以及如何修复它?

Apache 为什么retina shauniman.htaccess代码不能在服务器上运行,以及如何修复它?,apache,.htaccess,Apache,.htaccess,这个特定的.htaccess代码在我的托管服务器上不起作用的原因是什么? 它在本地和许多其他apache系统上工作得非常好。mod_rewrite在服务器上正常 <IfModule mod_rewrite.c> Options -MultiViews RewriteEngine on RewriteCond %{HTTP_COOKIE} HTTP_IS_RETINA [NC] RewriteCond %{REQUEST_FILENAME} !@2x RewriteRule ^(.*)

这个特定的.htaccess代码在我的托管服务器上不起作用的原因是什么? 它在本地和许多其他apache系统上工作得非常好。mod_rewrite在服务器上正常

<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine on
RewriteCond %{HTTP_COOKIE} HTTP_IS_RETINA [NC]
RewriteCond %{REQUEST_FILENAME} !@2x
RewriteRule ^(.*)\.(gif|jpg|png)$ $1@2x.$2
# if @2x isn't available fulfill the original request
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)@2x\.(gif|jpg|png)$ $1.$2
</IfModule>
顺便说一句,我经常遇到这样的问题,本地工作的.htaccess代码在服务器上不兼容,我不明白为什么会这样

如果您对我试图实现的目标感兴趣,请访问:

好的,在我的例子中,RewriteBase/元素解决了这个问题。如果有人为了Shaunimann视网膜代码而介入这个问题,我就把它放在那里

<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_COOKIE} HTTP_IS_RETINA [NC]
RewriteCond %{REQUEST_FILENAME} !@2x
RewriteRule ^(.*)\.(gif|jpg|png)$ $1@2x.$2
# if @2x isn't available fulfill the original request
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)@2x\.(gif|jpg|png)$ $1.$2
</IfModule>

到底是什么不起作用?你能说得更具体一点吗?实际上,网站上没有加载图像。如果您需要更多信息,请随时告诉我!