2010-12-12 115 views
1

我需要一些帮助.htaccess。我一直在使用URL重写,但没有条件,我很确定我需要他们看到,因为我无法得到这个工作。htaccess文件中的URL重写条件

的URL结构,我需要的是 - >forum/catnamehere(其中显示了一个名为catnamehere页) 和子结构 - >forum/catnamehere/fornamehere(显示了猫的子页)

然而,不知何故,我不能做到这一点,让我相信我需要条件。

回答

0

你应该可以用两条规则来做到这一点。

将在论坛目录.htaccess文件,并添加以下内容:

RewriteEngine On 
RewriteRule ^([a-zA-Z0-9_-]+)(/?)$ complexForumPath.php?catName=$1 [QSA] 
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)(/?)$ complexForumPath.php?catName=$1&subPage=$2 [QSA] 

的第一条规则会抢东西一样论坛/ abc123_

第二条规则将抓住论坛/ abc123_/abc123_