301 Redirect of folder to parent folder

I need to redirect /portfolio/year/ to /portfolio/.

The issue with the 301 I have written currently (redirect 301 /portfolio/year http://example.com/portfolio/) is that it redirects when someone attempts to access /portfolio/year/2000 or any of the other pages inside /year/.

Read More

Is there a way I can do this redirect? I need to keep bots and people from accessing the blank /portfolio/year/ page without breaking the rest of the internal pages.

Related posts

Leave a Reply

1 comment

  1. You don’t have to use PHP for this. Just replace your old RewriteRule with this one: RewriteRule ^portfolio/year/?$ portfolio [R=301] The $ at the end of the url makes sure that there are no more characters after portfolio/year/ or portfolio/year