带有3个子级别类别的PHP.htaccess
我有带有3个子级别类别的PHP.htaccess,php,.htaccess,Php,.htaccess,我有.htaccess设置 原始URL: 重写的URL: .htaccesscode RewriteEngine On RewriteRule ^([^/]*)/([^/]*)\.php$ /products.php?category=$1&product=$2 [L] 当我尝试运行规则并打开URL时:http://localhost/products/vehicles/bus.php,出现错误:找不到对象 那.htaccess代码有什么问题吗?还是少了什么 我想隐藏.php扩展名
.htaccess
设置
原始URL:
重写的URL:
.htaccess
code
RewriteEngine On
RewriteRule ^([^/]*)/([^/]*)\.php$ /products.php?category=$1&product=$2 [L]
当我尝试运行规则并打开URL时:http://localhost/products/vehicles/bus.php
,出现错误:找不到对象代码>
那.htaccess
代码有什么问题吗?还是少了什么
我想隐藏.php
扩展名,因此它将如下所示:
http://localhost/products/vehicles/bus
重写规则^products/([A-Za-z0-9-]+)/([0-9]+)/$
products.php?category=$1和product=$2[NC、L、QSA]
使用([A-Za-z0-9-]+)
表示字母数字,使用([0-9]+)
表示数字,如ID;或者使用确切的名称,例如产品
重写规则^products/([A-Za-z0-9-]+)/([0-9]+)/$
products.php?category=$1和product=$2[NC、L、QSA]
使用([A-Za-z0-9-]+)
表示字母数字,使用([0-9]+)
表示数字,如ID;或者使用确切的名称,例如products
您好,我尝试了您的代码,但仍然没有找到对象
,我有一个大致的答案:RewriteRule^/?products/([^/d]+)/?$products.php?category=$1[L,QSA]
,但它只在http://localhost/products/vehicles/
,我需要的是:http://localhost/products/vehicles/bus
所以您只需要添加额外的级别类别,如下所示:重写规则^/?products/([^/d]+)/([^/d]+)/?$products.php?category=$1&category2=$2[L,QSA]
效果。。。干杯,为什么一些url值显示我未找到对象
,示例:http://localhost/badar/products/produkterbaru/CT0002
它向我显示未找到的对象
,http://localhost/badar/products/terbaru/CT0002
它正确地显示了我现在得到了:),我添加了您的代码重写规则([A-Za-z0-9-]+)
您好,我尝试了你的代码,但仍然没有找到对象
,我有一个大致的答案:RewriteRule^/?products/([^/d]+)/?$products.php?category=$1[L,QSA]
,但它只在http://localhost/products/vehicles/
,我需要的是:http://localhost/products/vehicles/bus
所以您只需要添加额外的级别类别,如下所示:重写规则^/?products/([^/d]+)/([^/d]+)/?$products.php?category=$1&category2=$2[L,QSA]
效果。。。干杯,为什么一些url值显示我未找到对象
,示例:http://localhost/badar/products/produkterbaru/CT0002
它向我显示未找到的对象
,http://localhost/badar/products/terbaru/CT0002
它正确地显示了我现在得到了:),我添加了您的代码重写规则([A-Za-z0-9-]+)