[英].htaccess RewriteRule with one id parameter and no title parameter
我應該如何在 htaccess 文件中寫入來重寫這個
https://www.example.com/folder/subfolder/product.php?id=1
其中“id = 1”是數據庫中的product_id
作為https://www.example.com/product/name-of-the-product/
其中“產品名稱”是數據庫中產品的名稱
我的嘗試:
RewriteEngine On
Rewriterule ^product/(.+)\./ folder/subfolder/product.php?id=$1 [L]
我需要產品名稱而不是新網址中的 id,我該怎么做???
提前致謝!
用 ID-any-product-name 試試這個規則,例如。 https://www.example.com/product/1-any-product-name
RewriteRule ^product/(\\d+)-(.*)$ 文件夾/子文件夾/product.php?id=$1 [L]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.