我正在寻找包括以下重写规则,但似乎无法使其工作。我不想传入任何查询字符串,但我需要在规则中添加一个。htaccess从文件夹到查询字符串的文件夹重写规则
我希望这个网址:
https://example.co.uk/vehicles/
指:
https://example.co.uk/search-results/?category=1
但保持第一URL地址栏。 我需要传入一个名为类别的变量值。
我尝试以下,但它并没有为我工作:
rewriterule ^vehicles/$ search-results/?category=1 [NC, L]
任何帮助,将不胜感激。
RewriteEngine On
RewriteRule .* ? [F,L]
RewriteRule ^(.*)$ https://example.co.uk/$1 [R,L]
RewriteRule ^ad/(.*/)?([0-9]+)$ view-ad/?ad=$2 [NC,L]
RewriteRule ^vehicles/$ search-results/?category=1 [NC,L]
“没有工作” - 请更具体。究竟发生了什么?您在上面发布的指令会导致500内部服务器错误 - 因为_flags_参数中存在错误的_space_。 – MrWhite
我正在使用自己的服务器和网站。该页面加载但不能通过查询字符串变量。 – user3068032
修改为包含以上的.htaccess文件 – user3068032