你好我想要创建干净的网址
像这样 http://localhost:8081/olshop/products/category/[namecategory]/[paggingnumber]示例:http://localhost:8081/olshop/products/category/pants/1
这是我的.htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule index$ index.php [L]
RewriteRule ^products/category/([^/]+)/?$ index.php?p=products&category=$1 [L]
RewriteRule ^products/category/(.*)\/(\d+)\$ index.php?p=products&category=$1&page=$2 [L]
RewriteRule ^detail/([^/]+)/?$ index.php?p=detail_product&link_barang=$1 [L]
RewriteRule ^([^/.]+)/?$ index.php?p=$1 [QSA,L]
</IfModule>
当我尝试
时http://localhost:8081/olshop/products/category/pants/
这项工作
但不行 使用分页时(未找到404) http://localhost:8081/olshop/products/category/pants/1
帮助我谢谢:)
答案 0 :(得分:1)
这是因为您正在逃避规则中的$
RewriteRule ^products/category/(.*)\/(\d+)\$ index.php?p=products&category=$1&page=$2 [L]
删除反斜杠,你会没事的
RewriteRule ^products/category/(.*)\/(\d+)$ index.php?p=products&category=$1&page=$2 [L]