简体   繁体   English

.htaccess有2个rewriterule

[英].htaccess with 2 rewriterule

I have 2 diff strings: 我有2个差异字符串:

index.php?abrir=$1&id=$2 index.php?abrir=$1&livro=$2 index.php?abrir = $ 1&id = $ 2 index.php?abrir = $ 1&livro = $ 2

id= and livro= so I'm trying using this: id =和livro =所以我正在尝试使用它:

RewriteRule ^([a-zA-Z0-9_-]+)/?$ index.php?abrir=$1
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/?$ index.php?abrir=$1&id=$2
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/?$ index.php?abrir=$1&id=$2&pagina=$3

RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/?$ index.php?abrir=$1&livro=$2
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/?$ index.php?abrir=$1&livro=$2&pagina=$3

But only the first work... How I can resolve this? 但只有第一部作品......我怎么解决这个问题? Thanks! 谢谢!

The matching patterns in your rewrite rules for abrir=.. and livro=.. are identical. abrir = ..和livro = ..的重写规则中的匹配模式是相同的。 The first rewrite rule in a .htaccess file that matches for the current request is used. 使用匹配当前请求的.htaccess文件中的第一个重写规则。 So if you have two identical rewrite rules only the one that occurs first in your .htaccess file will work. 因此,如果您有两个相同的重写规则,那么.htaccess文件中首先出现的重写规则将起作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM