#Create friendly URL
RewriteRule ^$1-$2.php?$3=$4$ (.*)/(.*)/(.*)/(.*)/[L]
你好又一次stackoverflow!htaccess mod重写url显示404
我的网站目前siteup(姑且称之为site.com),也有这种设置:
http://site.com/category/page/variable1/value1/variable2/value2/
http://site.com/category/page/variable1/value1/
http://site.com/category/page/
http://site.com/
我想重写这些URL对:
http://site.com/category-page.php?variable1=value1&variable2=value2
http://site.com/category-page.php?variable1=value1
http://site.com/category-page.php
http://site.com/
上面的代码是一个我试图写。它不会给我服务器错误消息,但反而只是显然不工作 - 当我去http://site.com/category/page/variable1/value1/variable2/value2/,它只是给出了一个404错误。
你们能帮我吗?
在此先感谢
正则表达式和替换在您的RewriteRule中切换。你也提供了六个路径段的例子,但你的规则只允许四个。你有没有检查http://stackoverflow.com/tags/mod-rewrite/info标签wiki中的例子呢? – mario
http://stackoverflow.com/questions/1882694/mod-rewrite-pass-the-path-query-string-url-as-a-parameter – hungerstar
@mario这是我的设置的第二个例子,因为我只是测试了最初的重写。 – Thew