有没有办法让这个工作?.htaccess - 具有不同参数的干净网址
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^/]+)$ index.php?a=1&b=2 [L]
RewriteRule ^([^/]+)/([^/]+)$ index.php?a=$1&c=$2 [L]
的URL看起来应该是这样:
http://test.com/a/b
or
http://test.com/a/c
它仅与第一条规则的作品。
在我的情况下,我正在尝试创建一个配置文件页面,并通过$ _GET ['id']获得会话ID的ID。
所以,如果我去拜访某人的个人资料其他URL是
index.php?page=profile&id=25
/profile/25
如果我会去看我的个人资料是
index.php?page=profile
/profile
再举例来说,我想修改我的个人资料它是
index.php?page=profile&action=edit
/profile/edit
我希望你明白我的意思,并可以帮助我。
我不确定你的两个网址之间有什么区别,说应该使用a =来重定向到哪个网址。和b =?另一个应该是a =?和c = ?. – Gerrit0
例如:http://www.test.com/post/edit/或http://www.test.com/post/25 – smarvel
但是,这只是不会工作,因为它总是试图去test.com/ post/25 – smarvel