合并两个RewriteRules将覆盖第一个RewriteRules

问题描述 投票:0回答:1

我正在尝试同时应用两个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]
html apache .htaccess mod-rewrite
1个回答
0
投票

感谢@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]
© www.soinside.com 2019 - 2024. All rights reserved.