简体   繁体   中英

Rewrite domains to static html pages

I have 3 landings for 3 domains,

So I want:

.com to open index.html ,
.se to open index_sw.html ,
.es to open index_es.html

This is how I'm trying:

RewriteCond %{HTTP_HOST} ^www\.domain\.com [NC] 
RewriteRule ^(.*)$ index.html [NC,QSA] 
RewriteCond %{HTTP_HOST} ^www\.domain\.se [NC] 
RewriteRule ^(.*)$ index_sw.html [NC,QSA] 
RewriteCond %{HTTP_HOST} ^www\.domain\.es [NC] 
RewriteRule ^(.*)$ index_es.html [NC,QSA] 

but they are all resolving index.html ,

Any idea what am I missing?

-EDIT-

Tried:

Options +FollowSymLinks
RewriteEngine on

RewriteCond %{HTTP_HOST} ^www\.domain\.com [NC] 
RewriteRule ^(.*)$ index.html [NC,QSA] 
RewriteCond %{HTTP_HOST} ^www\.domain\.se [NC] 
RewriteRule ^(.*)$ index_sw.html [NC,QSA] 
RewriteCond %{HTTP_HOST} ^www\.domain\.es [NC] 
RewriteRule ^(.*)$ index_es.html [NC,QSA] 

But still seeing index.html

-EDIT-

Also tried with:

Options +FollowSymLinks
RewriteEngine on

RewriteCond %{HTTP_HOST} ^www\.domain\.com$ [NC] 
RewriteRule ^ /index.html [L] 

RewriteCond %{HTTP_HOST} ^www\.domain\.se$ [NC] 
RewriteRule ^ /index_sw.html [L] 


RewriteCond %{HTTP_HOST} ^www\.domain\.es$ [NC] 
RewriteRule ^ /index_es.html [L] 

same result...

Try this code in in your DOCUMENT_ROOT/.htaccess file:

RewriteEngine On

RewriteCond %{HTTP_HOST} ^www\.domain\.com$ [NC] 
RewriteRule ^ /index.html [L] 

RewriteCond %{HTTP_HOST} ^www\.domain\.se$ [NC] 
RewriteRule ^ /index_sw.html [L] 

RewriteCond %{HTTP_HOST} ^www\.domain\.es$ [NC] 
RewriteRule ^ /index_es.html [L] 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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