regex - RewriteRule to move directory folder without moving landing page -
regex - RewriteRule to move directory folder without moving landing page -
i’d redirect content of section of website without redirecting landing page of section.
its wordpress site way , talking moving categories under «directory».
here’s exemple of categories , redirect :
/articles-bebe/alimentation-bebe/ --> /cat/articles-bebe/alimentation-bebe/
here did don’t have create 1 000 redirect each categories.
rewriteengine on rewritebase / rewriterule ^articles-bebe/(.*)$ /cat/articles-bebe/$1 [r=301,l] rewriterule ^index\.php$ - [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /index.php [l] all redirect works great pages within section, « articles-bebe » has landing page don’t want redirect new section /cat/...
so needs remain :
/articles-bebe/ -> /articles-bebe/
when right getting redirected :
/articles-bebe/ -> /cat/articles-bebe/
is there way add together exception rewriterule added 2 pages no redirected new section ?
just alter regex utilize .+ instead of .*:
rewriterule ^(articles-bebe/.+)$ /cat/$1 [r=301,l] regex wordpress apache .htaccess mod-rewrite
Comments
Post a Comment