开发者

Using .htaccess redirect a site root to a site subfolder

I want to be able to redirect my visitors from http://www.example.com and http://example.com to http://example.com/blog.

How can I do th开发者_运维问答at, I saw some examples but any of them works for me.

Thanks.


You can either use mod_alias:

RedirectMatch 301 ^/$ http://example.com/blog

Or for more complex and conditional redirections mod_rewrite:

RewriteEngine on
RewriteRule ^$ http://example.com/blog [L,R=301]

Both do exactly the same but mod_rewrite may not always be available.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜