开发者

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

开发者 https://www.devze.com 2022-12-15 07:53 出处:网络
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 b

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 condi开发者_Python百科tions....

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!


Use backreferences for this one:

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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消