Home > Backend Development > PHP Tutorial > url 重定向,该怎么处理

url 重定向,该怎么处理

WBOY
Release: 2016-06-13 13:39:10
Original
1093 people have browsed it

url 重定向
test/year/2006/action/_add.html 如何将以上的url 重定向到以下 test.php 文件中
>>>
test.php?year=2006&action=_add

  
.htaccess该如何更改
# 将 RewriteEngine 模式打开
  RewriteEngine On

  # Rewrite 系统规则请勿修改
  RewriteRule ^archiver/((fid|tid)-[0-9]+\.html)$ archiver/index.php?$1
  RewriteRule ^forum-([0-9]+)-([0-9]+)\.html$ forumdisplay.php?fid=$1&page=$2
  RewriteRule ^thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ viewthread.php?tid=$1&extra=page\%3D$3&page=$2
  RewriteRule ^space-(username|uid)-(.+)\.html$ space.php?$1=$2
  RewriteRule ^tag-(.+)\.html$ tag.php?name=$1
RewriteRule ^k/(.*)/(.*).html$ /article.php?tid=$2&dtime=$1
ErrorDocument 404 /errors/notfound.html


------解决方案--------------------
RewriteRule ^test/year/([0-9]+)/action/([a-z\-]+)\.html$ test.php?year=$1&action=$2

没有测试,看看可以不

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template