I have a URL like example.com/product-name.html.
I want to redirect any URLs that contain the string html to search.php but I want to keep the original URL that was typed in, so if example.com/product-name.html was redirected to search.php it should still show example.com/product-name.html in the browser.
I am using:
RewriteCond %{REQUEST_URI} html RewriteRule .* search.php Which redirects but does not keep the original typed URL in the browser.
How can I do this?
2 Answers
Answers 1
Try with:
RewriteEngine on RewriteRule html search.php [NC,L] If it does not work, you have another problem in .htaccess (Please indicate it in full in your question) or config.
Start by clearing your cache before testing. Or try with another browser.
Answers 2
You need to Proxy RewriteRule and mod_proxy
RewriteRule "/(.*)\.html$" "/search.php" [P]
Make sure to enable and configure mod_proxy properly. mod_proxy documentation can be found here.
0 comments:
Post a Comment