簡體   English   中英

我想重定向並重寫我的網址

[英]I want to redirect and rewrite my urls

我有一個網址

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

文字是產品名稱。 我也想在某人想要訪問時

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()更多信息

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM