RewriteRule ^([A-Za-z0-9-_≈]+)/?$ page.php?text=$1
像domain.com/sample_text
命中转化为page.php?text=sample_text
不过,我想以下两个条件同时工作(并给出了相同的结果)。
1)如果他们去domain.com/sample_text/
我想保留在地址栏中的尾部斜杠,并显示page.php?text=sample_text
(现在它进入右页,但CSS和JS路径搞砸了)。
2)如果他们去domain.com/sample_text/worthlessdata123
我想剥去/之后的所有内容,在地址栏中保留domain.com/sample_text/
并显示page.php?text=sample_text
。
我已经挣扎了很多,但是我在正则表达式上很糟糕,而且我的头不能正常工作。
我只是输入相同的东西... – jeroen
辉煌!谢谢 :) – Mattis