问题
my htaccess file
<Files .htaccess>
order allow,deny
</Files>
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^(\w+)/*$ ./load.php?code=$1
load.php
<?php
echo $_GET['code'];
?>
if i typed www.example.com/1995
or www.example.com/1995/
php showing 1995
only. but after slash(/) type something url doesnt work. ex : www.example.com/1995/video-title
i want to if we type www.example.com/1995/video-title
php showing 1995
only.
how to do it? help me. thanks...
回答1:
Replacing
RewriteRule ^(\w+)/*$ ./load.php?code=$1
with
RewriteRule ^(\w+)/(.*)$ ./load.php?code=$1
RewriteRule ^(\w+)/*$ ./load.php?code=$1
should allow www.example.com/1995
, www.example.com/1995/
, www.example.com/1995/video-title
, or www.example.com/1995/video-title/
have 1995
printed in the php page.
来源:https://stackoverflow.com/questions/22889268/htaccess-rewriterule-and-after-slash-want-to-type-something