开发者

htaccess remove www from URL respect RewriteBase

In base directory it works fine, but if you go in subdirectory: example www.domain.com/dir/ used RewriteBase is lost. In htaccess I have something like this....

Options +FollowSymLinks
RewriteEngine On
RewriteBase /dir/
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule (.*) http://%1/$1 [R=301,L]

RewriteRule ^home/?$ index.php [L] 

So if we put www.domain.com/dir/home it redirect us to http://domain.com/home and /dir/ is missing ... What I is wrong ... T开发者_运维百科hanks for ideas.


Just put dir in Rule

RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/dir/$1 [L,R=301]
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜