本地设置工作。而重写URL好看发现了这个问题 我有部门,类别和产品列表....当我点击该部门的一个网址是来自问题重写模块htacess
Project /index.php?departmentId=1 to
Project/deptname-d1
改写,它会显示相关的类别,有针锋相对部门的扭曲是当该类别中选择一个服务器抛出找不到对象 选定的URL没有在服务器上发现引用的页面的链接似乎是错误或过时的 改写前的URL将
Project/index.php?departmentId=1&CategoryId=2
所需的url格式是 项目/ DEPTNAME-D1/catname-C2 在htacess正则表达式是这样的 选项+的FollowSymLinks RewriteEngine叙述上 RewriteBase /项目 的RewriteCond%{THE_REQUEST}^GET * /指数。(PHP的|?HTML)\ HTTP RewriteRule ^(。 )index。(php | html?)$ $ 1 [R = 301,L] #rewrite部门规则 RewriteRule ^。?-d([0-9] +)/ page - ([0-9] +)/?$ index.php? DepartmentId = $ 1 & Page = $ 2 [L] RewriteRule ^。 ?-d([0-9] +)/?$ index.php?DepartmentId = $ 1 [L] #规则类别 RewriteRule ^。 -d([0-9] +)/ ^。 -c([0-9] +)/ page - ([0-9] +)/?$ index.php?DepartmentId = $ 1 & CategoryId = $ 2 & Page = $ 3 [L] RewriteRule^ -d([0-9] +)/ ^。 c([0-9] +)/?$ index.php?DepartmentId = $ 1 & CategoryId = $ 2 [L] #rewrite产品规则 Rewriterule ^。?-p([0-9] +)/ $的index.php?productId参数= $ 1
改写以下之前,网址 本地主机/项目/前排 页本地主机/项目/的index.php? DepartmentId = x部门首页 localhost/project/index.php?DepartmentId = x & page = zfor department pag localhost/project/index.php?DepartmentId = x & CategoryId = y类别首页 localhost/project/index.php?DepartmentId = xCategoryId = y & page = z用于分类页面 localhost/project/ProductId = Q 这些是要以下列格式重写的输入Url localhost/project /首页 localhost/project/department-name-dx /部门首页 localhost/project/department-name-dx/page-z /部门页面 localhost/project/department-name- DX /分类名-CY /为类别前 本地主机/项目/部门名称-DX /分类名-CY /页-Z的类别页面
Please note tat department and product related regex are working fine only the category page is acting weird can someone explain wats going wrong
修复.htaccess中的规则,并添加:'RewriteRule Project/deptname-d(\ d +)/?$ /index.php?departmentId=$1 [L]' – vmeln
不幸运..我试过你的方法现在服务器抛出错误500 – newbie
它不应该,请张贴固定.htaccess – vmeln