我正在尝试同时应用两个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]