indexing - how to I redirect a domain using the index.html file? -
i have 2 domain names have each domain name directing same ip. how redirect each domain correct place using index.html file? below pseudo code:
if web adddress= http://sitea.com forward http://sitea.com/sitea_dir if web address = http://siteb.com forward http://siteb.com/siteb_dir else go localhost:80 i not want use htaccess file have not made one. have code in index.html file:
<meta http-equiv="refresh" content="0; url=http://sitea/sitea_dir" />
you can achieve in javascript:
<script> var domain = window.location.href; domain = domain.replace('http://', ''); domain = domain.replace('.com/', ''); domain = domain.replace('.com', ''); switch (domain) { case 'sitea': window.location.href = 'http://sitea.com/sitea_dir'; break; case 'siteb': window.location.href = 'http://siteb.com/siteb_dir'; break; default: window.location.href = 'http://127.0.0.1/'; } </script>
Comments
Post a Comment