我想重定向和重写我的url


I want to redirect and rewrite my urls

我有一个url像

http://www.mywebsite.com/shop-single-full.php?img=35

我想重写并重定向这个url,像

http://www.mywebsite.com/Pure-Copper-Embossed-Jug-amp-4-Steel-Copper-Glass-Set-35.html

,其中文本为产品名称。我还想当有人想访问

http://www.mywebsite.com/shop-single-full.php?img=35 
它会自动重定向到
http://www.mywebsite.com/Pure-Copper-Embossed-Jug-amp-4-Steel-Copper-Glass-Set-35.html

无论我做了什么都是

RewriteRule ^shop-single-full/?$ ([A-Za-z0-9_'-]+)'-([0-9]+).html?%1 [R,L]
RewriteRule ^([A-Za-z0-9_'-]+)'-([0-9]+).html?$ /shop-single-full.php?img=$2&name=$1

但是在重定向中有一些问题。由于

shop-single-full.php中使用header()

header("Location: http://www.mywebsite.com/Pure-Copper-Embossed-Jug-amp-4-Steel-Copper-Glass-Set-35.html");

点击这里阅读更多关于header()的信息