0

how change parameters of url with htaccess

I have 2 url like this:

1- example.org/?ptype=writer/5/jon-sina   
2- example.org/?ptype=publisher/10/ali-ssadeghi

I want to redirect that 2 address to these:

1- example.org/?ptype=product/5/jon-sina  
2- example.org/?ptype=product/10/ali-ssadeghi

*

I wanna just change "writer" and "publisher" to: "product"

*

help me plz :)

4

1 回答 1

3

将以下指令添加到您的 .htaccess :

RewriteEngine on
RewriteCond %{QUERY_STRING} ^ptype=(writer|publisher)(.*)$
RewriteRule ^(.*)$ $1?ptype=product%2 [R=301,L]
于 2013-06-13T09:03:03.587 回答