0

I am going to rewrite the path of a url with PHP $get.

Orignal Path:

https:www.abc.com/category.php?filter_ids=21

What I want:

  1. https:www.abc.com/xyz can show the info.
  2. https:www.abc.com/category.php?filter_ids=21 will change to new path when I access it.

I have wrote this on RewriteEngine:

RewriteRule ^category\.php\?filter_ids=21$  /xyz [R=301,QSA,L]
RewriteRule ^xyz$ category.php?filter_ids=21        [QSA,L]

https:www.abc.com/xyz is work, I can see the content of the original link.

However, I don't know how to show the new path when I access the site with the original path.

Can anyone teach me more on it? Or provide a solution for me please?

Isaac Ng
  • 1
  • 1
  • You don't. You migrate to the new paths and hope the old ones die out. --- Else: See "ping pong rewrites", and heaps of cumbersome `%{QUERY_STRING}` matching. – mario Mar 21 '18 at 08:24
  • Can you provide some website for me? I still don't understanding your meaning. Thanks Bro. – Isaac Ng Mar 21 '18 at 08:36
  • That's the right direction. But you can't match query string params in the RewriteRule alone. See the four links given. (There are a hundred more similar questions, btw.) – mario Mar 21 '18 at 09:54

0 Answers0