.htaccess redirect all files in one folder to exac

2019-05-20 00:22发布

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....

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.

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

2条回答
我想做一个坏孩纸
2楼-- · 2019-05-20 00:44

Use backreferences for this one:

RewriteRule ^foo/(.*)$ bar/$1
查看更多
冷血范
3楼-- · 2019-05-20 00:56

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

查看更多
登录 后发表回答