I'm trying to rewrite part of a URL with a 301 htaccess rewrite. So far I got this
RewriteRule ^index.php?option=com_payplans&view=subscription&task=display&subscription_key=(.*)$ /subscriptiondetails/display/$1 [R=301,L,NC]
I want to go from
http://www.example.com/index.php?option=com_payplans&view=subscription&task=display&subscription_key=8O56WXCMQEZ5
to
http://www.example.com/subscriptiondetails/display/8O56WXCMQEZ5
Just can't quite figure out what I'm missing or doing wrong.
You need to use a RewriteCond
to match query string:
RewriteCond %{QUERY_STRING} ^option=com_payplans&view=subscription&task=display&subscription_key=(.*)$
RewriteRule ^index\.php$ /subscriptiondetails/display/%1? [R=301,L,NC]