4

I need to Display an custom url source,when users mistype an subdomain.

For example , If user types hames.domain.com instead of games.domain.com , The hames.domain.com should display html source of index of domain.com.

P.s : i dont want iframe or redirection,It needs to display index of main domain.

i tried below code

RewriteCond %{HTTP_HOST} ^([^.]+)\.example\.com$ [NC]
RewriteRule ^%1/(.*)$ /$1 [L,NC]
4

1 回答 1

1

Humm I'm not a pro with htaccess, but if the user types a wrong sub domain he'll get a 404 error. So redirect him to your domain if he gets it.

ErrorDocument 404 domain.com

于 2012-11-09T15:05:50.310 回答