开发者

Help on Restructure URLs (Move Parts of URL) with Mod-Rewrite

开发者 https://www.devze.com 2023-02-23 04:44 出处:网络
I have a multi-language WordPress website where the URL has the following URL structure: http://www.domain.com/yyyy/mm/dd/abcdefg/xx-yy/

I have a multi-language WordPress website where the URL has the following URL structure:

http://www.domain.com/yyyy/mm/dd/abcdefg/xx-yy/

where xx-yy is the language code.

I intend to make the URL as below:

http://www.domain.com/xx-yy/yyyy/mm/dd/abcdefg/

Where the language code in URL has been moved to the front.

Anybody has any idea what mod-rewrite co开发者_JAVA百科de which i can used in .htaccess to automatically redirect from the old URL to new URL?

Thanks a lot for any help.


Add this rule to make that work:

RewriteEngine on
RewriteRule ([0-9]+)\/([0-9]+)\/([0-9]+)\/(.+)\/(.*)\/$ /$5/$1/$2/$3/$4/

This will redirect: http://www.domain.com/2011/04/07/abcdefg/xx-yy/ to http://www.domain.com/xx-yy/2011/04/07/abcdefg/

0

精彩评论

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