html - 结合两个 RewriteRules 覆盖第一个
问题描述
我正在尝试同时应用两个 RewriteRules。它们都完全按照预期独立工作(当另一个被注释掉时),但是当.htaccess
一起放在文件中时,只有第一条规则有效。
我怎样才能一起使用这些?
RewriteEngine On
# Redirect everything to this file
RewriteRule ^ public/index.php [QSA,L]
# Rewrite location of the storage files making them public
RewriteRule ^storage/(.*)$ app/files/public/$1 [QSA]
解决方案
感谢@CBroe的帮助,这是解决方案:
RewriteEngine On
# Rewrite location of the storage files making them public
RewriteRule ^storage/(.*)$ app/files/public/$1 [QSA,L]
# Redirect everything to this file
RewriteRule ^ public/index.php [QSA]
推荐阅读
- user-interface - 重新创建 Pinterest UI Flutter
- c# - 关闭代码文件时自动折叠区域
- angular - 带有可重用子组件示例的 Angular 8 反应式表单
- notepad++ - 大型 .A2L 文件,引用的翻译问题
- mysql - MySQL:如何在客户端和服务器端都启用本地加载数据
- angular - 对返回 ValidatorFn[] 类型的函数进行单元测试
- php - 当我在其他文件中调用它们时,类静态变量会重置
- java - Java Hibernate 的主键有问题吗?
- java - JDBC 拒绝使用指定的密码
- javascript - React Native,Javascript 如何自定义 android 键盘