Jump to content

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/179743-redirect-from-any-subfolder-to-root/
Share on other sites

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.

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.