如何重写这种类型的URL:
// the `E` generic type brings you nothing, as you can't make use of it at compile time,
// so you can simply drop it and go with a mere `Object[]` array, as per @Lino
public static <E> Serializable returnArray(E[] values) {
// exclude null values if any (note that `E` proves itself useless already):
final Stream<?> stream = Stream.of(values).filter(Objects::nonNull);
if (values instanceof Number[]) {
// you can use mapToDouble and doubleValue, for a more accurate sum
return stream.map(Number.class::cast).mapToInt(Number::intValue).sum();
} else {
// squash characters, but use a space separator for anything else
final String separator = (values instanceof Character[]) ? "" : " ";
return stream.map(Object::toString).collect(Collectors.joining(separator));
}
}
拥有这样的东西:
https://example.com/assets/forms/vanilla/index.php?property=cus_F8fylX6aITpJOR
如何在之后访问https://example.com/forms/cus_F8fylX6aITpJOR
和property
参数?
谢谢。
答案 0 :(得分:0)
您可以使用RewriteCond%{QUERY_STRING}来查询字符串
类似的东西:
RewriteCond %{QUERY_STRING} property=(\w+) [NC]
RewriteRule ^assets/forms/([a-zA-Z]*)/index.php /forms/%1?$1 [L]