【发布时间】:2021-05-09 13:00:42
【问题描述】:
我正在这个动态“产品”文件夹上生成一个动态页面。
工作正常 category/product/heading-1
当我只访问 category/product/ 文件夹时,它会显示一个错误
Not Found The requested URL was not found on this server.
#This file in the category folder
RewriteEngine on
RewriteRule ^product/([0-9a-zA-Z]+) product.php?u=&1 [NC,L]
如何将 category/product/ 重定向到 exmple.com/category/product.php
【问题讨论】:
-
你试过
RewriteRule ^product product.php [NC,L]吗?但是,我通常建议将front controller 模式与router 一起使用,而不是在Web 服务器上设置所有URL 重写。它还使得将应用程序从一个 Web 服务器移动到另一个 Web 服务器变得更加容易(例如不读取 htaccess 文件的 nginx)。
标签: javascript jquery .htaccess redirect mod-rewrite