JS

how to redirect non www to www using javascript

Pinterest LinkedIn Tumblr

<script type=”text/javascript”>
if ( document.domain.substring(0,4).toLowerCase() != ‘www.’ ) {
window.location = document.URL.replace(“//”,“//www.”);
}
</script>

Write A Comment

Faster PHP Cloud Hosting