我无法确定如何在我的.htaccess规则中执行以下设置。我的目标是获取 lang = es 参数并将其转换为URL中的/ es,同时保留结果URL中的所有其他参数。
原始网址的示例方案
https://example.com/?lang=es | Includes question mark
https://example.com?lang=es | Excludes question mark
https://example.com/?lang=es¶m1=apple | Includes an additional parameter
https://example.com/?lang=es¶m1=apple¶m2=banana | Includes unlimited additional parameters
https://example.com/?param1=apple&lang=es | Lang parameter not the first one in the URL
每种方案的所需输出
https://example.com/es
https://example.com/es
https://example.com/es/?param1=apple | Note this strips the "&" that was preceding param1 in the original URL
https://example.com/es/?param1=apple¶m2=banana
https://example.com/es/?param1=apple
在撰写这些规则时,我是一位相对新手,所以我们非常感谢所有的帮助!