简体   繁体   English

.htaccess-将domain.com和www.domain.com重定向到www.domain.com/en

[英].htaccess - redirect domain.com and www.domain.com - to www.domain.com/en

I have a language setup on my pages, so that my root page will always be domain.com/en 我的页面上设置了语言,因此我的根页面始终是domain.com/en

So what im looking to do is redirect all queries to domain.com and www.domain.com to domain.com/en. 因此,我想做的是将所有查询重定向到domain.com,将www.domain.com重定向到domain.com/en。

Any ideas? 有任何想法吗?

RewriteCond %{REQUEST_URI} !^/en/
RewriteRule ^(.*)$ http://www.domain.com/en/$1 [R=301,L]

If domain.com and www.domain.com have the same root folder, put .htaccess there with 如果domain.com和www.domain.com具有相同的根文件夹,则将.htaccess放在其中

RewriteEngine On
RewriteCond %{REQUEST_URI} !^/en/
RewriteRule ^(.*)$ http://www.domain.com/en/$1 [R=301,L]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM