开发者

Using .htaccess redirect a site root to a site subfolder

开发者 https://www.devze.com 2022-12-29 06:48 出处:网络
I want to be able to redirect my visitors from http://www.example.com and http://example.com to http://example.com/blog.

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

精彩评论

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