htaccess rewriterule和slash之后想要输入一些东西

时间:2014-04-06 02:22:33

标签: php apache .htaccess mod-rewrite

我的htaccess文件

<Files .htaccess>
order allow,deny
</Files>

Options +FollowSymLinks
RewriteEngine On

RewriteRule ^(\w+)/*$ ./load.php?code=$1

load.php

<?php
echo $_GET['code'];
?>

如果我输入www.example.com/1995www.example.com/1995/只显示1995的php。但在斜杠(/)之后输入某个url不起作用。例如:www.example.com/1995/video-title

我想如果我们只输入显示www.example.com/1995/video-title的{​​{1}} php。

怎么做?帮我。感谢...

1 个答案:

答案 0 :(得分:0)

更换

RewriteRule ^(\w+)/*$ ./load.php?code=$1

RewriteRule ^(\w+)/(.*)$ ./load.php?code=$1
RewriteRule ^(\w+)/*$ ./load.php?code=$1

应该允许{php}页面中显示www.example.com/1995www.example.com/1995/www.example.com/1995/video-titlewww.example.com/1995/video-title/ 1995