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

Popular posts from this blog

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

Is there a way to convert an HTML page styled with Bootstrap CSS into email-compatible html? -