简体   繁体   English

php标头网址重定向和htacces

[英]Php header url redirect and htacces

I'm confused about apache RewriteRule in htaccess. 我对htaccess中的Apache RewriteRule感到困惑。 I have hundreds of header('Location: script_name.php'); 我有数百个header('Location: script_name.php'); in my webapp and would like to make url's more user friendly (not SEO friendly as search engines won't be allowed to crawl the app). 在我的webapp中,并且希望使url更加用户友好(不支持SEO,因为不允许搜索引擎抓取该应用)。 Here's a typical piece of code : 这是一段典型的代码:

if(isset($_POST['get_product']))
{
    // PHP/PDO code here
    header('Location: product_catalog_detail.php?with or without query strings');
} 

that gives : 给出:

http://localhost/smart_entreprise/folder1/folder2/product_catalog_detail?catID=1&productID=1

Now I'd like to keep this URL server-side and show the user this for all script names beginning with product_catalog : 现在,我想将此URL保留在服务器端,并向用户显示所有以product_catalog开头的脚本名称:

http://localhost/smart_entreprise/folder1/folder2/catalog

or even better : 甚至更好:

http://localhost/smart_entreprise/catalog

Doest it makes sense ? 这样做有意义吗? Thanks. 谢谢。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM