-2

How do you force the root domain uses? I want to know how to do this in

html, php, Javascript, .htaccess,jQuery,  ajax.

I know about the meta refresh

as shown here:

<meta http-equiv="refresh" content="0; url=http://example.com/" />

and here I know this too:

<body onload="window.location.href = 'your URL';"></body> 

as well as: Php

<?php header('Location: https://example.com'); ?> 

but none of those work for what I want. Multiple methods would be nice!

Universal Omega
  • 206
  • 1
  • 5
  • 26

1 Answers1

1

Make sure your htaccess rewrites are working.

use this on your htaccess

RewriteEngine On
RewriteBase /
Rewritecond %{HTTP_HOST} ^www\.yoursite\.com$ [NC]
RewriteRule ^(.*)$ https://yoursite.com/$1 [R=301,L]
ASR
  • 1,801
  • 5
  • 25
  • 33