Reputation: 23
I want to accomplish the following with htaccess redirect.
How do I replace/redirect this
/kb_results.asp?ID=16
by
/catalogsearch/result/?q=16
So the url in the end is domain.com/catalogsearch/result/?q=16
Thanks in advance for any tips or help.
Upvotes: 0
Views: 101
Reputation: 143846
Using mod_rewrite, you can add these rules to the htaccess file in your document root:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^ID=([0-9]+)$
RewriteRule ^kb_results.asp$ /catalogsearch/result/?q=%1 [L,R]
If you want the redirect to be permanent, change the R
flag to R=301
, or if you want the URI to be internally rewritten (instead of an external redirect), then remove the R
flag entirely.
Upvotes: 1