[英]Php header url redirect and htacces
我對htaccess中的Apache RewriteRule感到困惑。 我有數百個header('Location: script_name.php');
在我的webapp中,並且希望使url更加用戶友好(不支持SEO,因為不允許搜索引擎抓取該應用)。 這是一段典型的代碼:
if(isset($_POST['get_product']))
{
// PHP/PDO code here
header('Location: product_catalog_detail.php?with or without query strings');
}
給出:
http://localhost/smart_entreprise/folder1/folder2/product_catalog_detail?catID=1&productID=1
現在,我想將此URL保留在服務器端,並向用戶顯示所有以product_catalog
開頭的腳本名稱:
http://localhost/smart_entreprise/folder1/folder2/catalog
甚至更好:
http://localhost/smart_entreprise/catalog
這樣做有意義嗎? 謝謝。
#/webroot/.htaccess
RewriteRule ^smart_entreprise\/(\w+)$ product_catalog_detail.php?catID=$1
請參見
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.