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/.
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.
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 afterportfolio/year/
orportfolio/year