问题描述
我的htaccess的文件
my htaccess file
<Files .htaccess>
order allow,deny
</Files>
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^(\w+)/*$ ./load.php?code=$1
load.php
load.php
<?php
echo $_GET['code'];
?>
如果我输入 www.example.com/1995
或 www.example.com/1995 /
PHP的表现 1995年
只。但斜线后(/)输入一些URL不工作。例如: www.example.com/1995/video-title
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
我想,如果我们键入 www.example.com/1995/video-title
PHP显示 1995
只
i want to if we type www.example.com/1995/video-title
php showing 1995
only.
该怎么办呢?帮我。谢谢...
how to do it? help me. thanks...
推荐答案
更换
RewriteRule ^(\w+)/*$ ./load.php?code=$1
与
RewriteRule ^(\w+)/(.*)$ ./load.php?code=$1
RewriteRule ^(\w+)/*$ ./load.php?code=$1
应该允许 www.example.com/1995
, www.example.com/1995 /
, www.example.com/1995/video-title
或 www.example.com/1995/video-title /
有 1995年
打印在PHP页面。
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.
这篇关于htaccess的重写规则和斜线后要输入一些东西的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!