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 after portfolio/year/
or portfolio/year
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.