开发者

Complex .htaccess rule help

开发者 https://www.devze.com 2023-01-01 06:07 出处:网络
I\'m struggling to write a .htaccess file. I need to redirect addresses such as: /archives/YYYY/MM/post-name

I'm struggling to write a .htaccess file.

I need to redirect addresses such as:

/archives/YYYY/MM/post-name

to

/blog/post-name

Any help would开发者_StackOverflow be appreciated!


Make sure your rewrite engine is on:

RewriteEngine on
RewriteRule ^/archives/([^/]*)/([^/]*)/([^/]*)/?$ /blog/$3 [L] 

You can narrow it down by using {0-9,4} for the year and {0-9,2} for the month.

0

精彩评论

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