我有一个类似的网址example.com/product-name.html
。
我想将包含该字符串的所有URL重定向html
到,search.php
但是我想保留输入的原始URL,因此如果example.com/product-name.html
重定向到search.php
该URL,它仍应example.com/product-name.html
在浏览器中显示。
我在用:
RewriteCond %{REQUEST_URI} html
RewriteRule .* search.php
它将重定向,但不会在浏览器中保留原始键入的URL。
我怎样才能做到这一点?
尝试:
RewriteEngine on
RewriteRule html search.php [NC,L]
如果不起作用,则说明.htaccess(请在问题中完整说明)或配置中存在另一个问题。
首先在测试之前清除缓存。或尝试使用其他浏览器。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句