本文介绍了htaccess的重写规则和斜线后要输入一些东西的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的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的重写规则和斜线后要输入一些东西的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-15 09:04