imperium2335 Posted October 31, 2009 Share Posted October 31, 2009 Hi, How do I redirect people who directly go to the following: folder-a/folder-b/folder-c/cheese.html to: www.mysite.com ? the names of the folders are different too except for folder-a, I just want it so you are redirected from anywhere within folder-a if you get what i mean? Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/179743-redirect-from-any-subfolder-to-root/ Share on other sites More sharing options...
Dragen Posted October 31, 2009 Share Posted October 31, 2009 Probably something like: RewriteRule ^folder-a/?(.+)?$ / [R,NC] Quote Link to comment https://forums.phpfreaks.com/topic/179743-redirect-from-any-subfolder-to-root/#findComment-948342 Share on other sites More sharing options...
imperium2335 Posted October 31, 2009 Author Share Posted October 31, 2009 Cheers, I tried this out: RedirectMatch 301 ^/cake-photo-pages/.*$ http://www.cake-photos.com/ and it worked like a charm. Anything bad about using this method I should know about? And will this exclude Googlebot from crawling everything in there? I would love to be able to exclude everyone except Googlebot. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/179743-redirect-from-any-subfolder-to-root/#findComment-948344 Share on other sites More sharing options...
Dragen Posted October 31, 2009 Share Posted October 31, 2009 To be honest I've never used RedirectMatch before, I'd use this: RewriteRule ^^/cake-photo-pages/.*$ http://www.cake-photos.com/ [R=301,NC] Although I don't know which one is better. And yes it will also re-direct googlebot. I think you can specify not to re-direct for certain bots or ip addresses, but I haven't looked into it. Quote Link to comment https://forums.phpfreaks.com/topic/179743-redirect-from-any-subfolder-to-root/#findComment-948347 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.