的.htaccess重定向的所有文件在一个文件夹苛求在另一个文件夹相同 [英] .htaccess redirect all files in one folder to exact same in another folder

查看:120
本文介绍了的.htaccess重定向的所有文件在一个文件夹苛求在另一个文件夹相同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们只需要每一页动一个名为音乐,以所谓的信息......这是唯一的变化目录目录内。有很多链接到网页的音乐,我们并不想打破他们。我不是很擅长改写条件......

We simply have to move every page inside of a directory called "Music" to a directory called "Information"... That's the only change. There's lots of links to pages music and we don't want to break them all. I'm not great at rewrite conditions....

基本上,所有我想要做的就是当音乐/ index.php的用户类型,例如,或音乐/生活/ mypage.php,简单地重定向到资料/ index.php文件或信息/生活/我的空间.PHP ...只是改变从音乐到信息。我希望做正确的网址(信息)在URL框中显示。

Basically, all I want to do is when a user types in music/index.php, for example, or music/life/mypage.php, to simply redirect it to information/index.php or information/life/mypage.php... just change from music to information. And I do want the correct URL (information) to show in the URL box.

...我是pretty的激怒。我一直试图让这件事的所有该死的下午!

...I'm pretty exasperated. I've been trying to get this thing all darn afternoon!

推荐答案

使用反向引用了这样一句:

Use backreferences for this one:

RewriteRule ^foo/(.*)$ bar/$1

这篇关于的.htaccess重定向的所有文件在一个文件夹苛求在另一个文件夹相同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆