• Hi, I’ve done 301 redirects before using htaccess, but I’m wondering if there’s a way to redirect just the first page of a folder instead of the whole folder?

    For example:

    Options +FollowSymlinks
    RewriteEngine On
    Redirect 301 https://site.com/class https://site.com/newclass

    This code above works fine, but if I go to a deeper page such as: https://site.com/class/member it redirects it to https://site.com/newclass/member – which I do NOT want. I would like all of the other pages to stay the same, but just redirect the “home” page for that folder. Is that possible?

Viewing 1 replies (of 1 total)
  • If you only want the parent directory to redirect, use a regex and RedirectMatch with a $ end character:

    Redirect 301 /class/?$ https://site.com/newclass
Viewing 1 replies (of 1 total)
  • The topic ‘.htaccess redirect for page, not folder’ is closed to new replies.