开发者

.htaccess redirect non-www to www except for a particular subdirectory

I need to redirect all example.com to www.example.com except开发者_JAVA技巧 for example.com/subdirectory which should remain as is without any redirection.


I have solved the problem by having the following in the .htaccess file

RewriteEngine On

RewriteCond $1 !^subdirectory RewriteCond %{HTTP_HOST} !^www.example.com$ [NC] RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜