简体   繁体   English

.htaccess将一个文件夹中的所有文件重定向到另一个文件夹中的完全相同

[英].htaccess redirect all files in one folder to exact same in another folder

We simply have to move every page inside of a directory called "Music" to a directory called "Information"... That's the only change. 我们只需将名为“Music”的目录中的每个页面移动到名为“Information”的目录中......这是唯一的变化。 There's lots of links to pages music and we don't want to break them all. 页面音乐有很多链接,我们不想打破它们。 I'm not great at rewrite conditions.... 我在重写条件方面表现不佳....

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. 基本上,我想要做的就是当用户键入music / index.php,例如,或者music / life / mypage.php时,只需将其重定向到information / index.php或information / life / mypage.php。 ..只是从音乐变为信息。 And I do want the correct URL (information) to show in the URL box. 我确实希望在URL框中显示正确的URL(信息)。

...I'm pretty exasperated. ......我很生气。 I've been trying to get this thing all darn afternoon! 我一直在努力让这件事在下午完成!

使用反向引用这个:

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

RedirectMatch ^ /富/酒吧/(.*) http://www.wherever.org/a/foo/bar/ $ 1

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM