将 css 文件重写为控制器的操作
我想使用 .htaccess 将 http://localhost/css/file.css 重写为 http://localhost/css/generate
可以吗?
它似乎不起作用。我所拥有的就是这个 .htaccess 和 Zend Controller css 以及操作 generate
如果我直接进入 localhost/css/generate 我有 css 输出,但是当我输入 localhost/css/ 时file.css 我得到 Not Found
这是我的 .htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^/css/file\.css$ /css/generate
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
I would like to use .htaccess to rewrite http://localhost/css/file.css to http://localhost/css/generate
is it possible to do it?
it seems to not working. All I have is this .htaccess and Zend Controller css with action generate
if I go directly to localhost/css/generate I have css output but when I type localhost/css/file.css I get Not Found
this is my .htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^/css/file\.css$ /css/generate
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
将您的 htaccess 更改为:
[L] 表示“最后”,如果找到匹配项,它将停止运行任何后续规则。
Change your htaccess to this:
the [L] means "last", which stops it running any subsequent rules if a match was found.
是的。将其放入顶级
.htaccess
或httpd.conf
中并重新启动 Apache。Yes. Place this in your top level
.htaccess
orhttpd.conf
and restart Apache.