1
我將我的博客從example.com移至example.com/blog。我現在在example.com上有一個啓動頁面。我希望像example.com/2011/example-post這樣的舊博客帖子請求重定向到example.com/blog/2011/example-post;但請求example.com允許不重定向。htaccess只重定向子目錄請求(不是TLD請求)
我將我的博客從example.com移至example.com/blog。我現在在example.com上有一個啓動頁面。我希望像example.com/2011/example-post這樣的舊博客帖子請求重定向到example.com/blog/2011/example-post;但請求example.com允許不重定向。htaccess只重定向子目錄請求(不是TLD請求)
試試這個:
RewriteEngine On
RewriteRule ^([0-9]{4}/.+)$ /blog/$1 [R=301,NC]
這將重定向所有具有數字4個位數(年)和斜線的東西后,所以一切都必須在example.com會像正常的網頁example.com/about.html
謝謝!那就是訣竅。 – drew 2011-03-10 22:16:02