htaccess重写/ modrewrite帮助!

时间:2011-06-09 19:11:36

标签: html .htaccess

我有以下网址http://puppetweb.ca/play/jokes.php?c=Get Well Soon(快点好了,可以是任何类别的名字,比如成人笑话,Blah Blah,它总会间隔XXXX XXXX格式),我想改变它所以它就像http://puppetweb.ca/play/Get-Well-Soon/(或类别名称)

我有

Options +FollowSymLinks
RewriteEngine on
RewriteRule http://puppetweb.ca/(.*)/$ /jokes.php?c=$1

但它似乎没有起作用。

2 个答案:

答案 0 :(得分:1)

因为你的正则表达式正在寻找尾随/在行尾。试试这个......

RewriteRule http://puppetweb.ca/(.*)/?$ /jokes.php?c=$1

答案 1 :(得分:0)

http://puppetweb.ca/play/Get-Well-Soon/重写为http://puppetweb.ca/play/jokes.php?c=Get Well Soon。那是你要的吗?如果是,请添加此重写规则:

RewriteEngine on
RewriteRule ^play/(.*)/$ /play/jokes.php?c=$1