开发者

I want to 301 redirect a part of an url, but not the childeren of the url

开发者 https://www.devze.com 2023-02-24 02:37 出处:网络
For an example: www.domain.com/part1/part2 has to be 201, but if you type www.domain.c开发者_开发百科om/part1 it has to be redirected to www.domain.com.

For an example:

www.domain.com/part1/part2 has to be 201, but if you type www.domain.c开发者_开发百科om/part1 it has to be redirected to www.domain.com.

The normal redirect works by part2 aswell.


If you only need to redirect if there is not a second-level to the path, you should be able to use the following:

RewriteEngine on
RewriteRule part1$ / [L,R=301]

Hope this helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消