首页 > 解决方案 > htaccess 重定向或重写规则

问题描述

基本上,我有这个我想概括的 htaccess 规则:

RewriteCond %{QUERY_STRING} (^|&)sale/details\.php\?id\=1234($|&)
RewriteRule ^properties$ /property/1234?&%{QUERY_STRING}

我想在条件中用正则表达式 ([0-9]+) 替换 1234 并在我的规则中检索如下:

RewriteCond %{QUERY_STRING} (^|&)sale/details\.php\?id\=([0-9]+)($|&)
RewriteRule ^properties$ /property/$1?&%{QUERY_STRING}

但它不起作用,我做错了什么?

提前致谢。

标签: apache.htaccess

解决方案


推荐阅读