我有一個URL,如example.com/product-name.html
。htaccess如果URL包含字符串重定向到頁面而不更改URL
我想重定向包含字符串html
到search.php
任何網址,但我想保持這是鍵入原始的URL,因此,如果example.com/product-name.html
被重定向到search.php
應該還是在瀏覽器中顯示example.com/product-name.html
。
我使用:
RewriteCond %{REQUEST_URI} html
RewriteRule .* search.php
被重定向,但不會保留原來的輸入的網址在瀏覽器中。
我該怎麼做?
這兩行不重定向。重定向發生在其他地方。你應該顯示你的整個.htaccess。 – Rei
嘗試使用'RewriteRule(。*)/search.php [L]',看看它是否適用於您 –
「重定向但不保留原始類型的URL在瀏覽器中。」 - 你在瀏覽器中看到了什麼網址? – MrWhite