Redirecting site url from to https://new-domain-name (still hosted at

im back again

is it posible to set a rule in .htaccess or some other way that can check the url and redirect ?

I have a domain name registered to which has cloudflare enabled for ssl and is working great

if someone visits instead of they get the insecure connection

so I was wondering if theres a way to detect the url and if its it will redirect to

can that be done ?


would this work ? I dont want to try it in case something goes terribly wrong :frowning:

RewriteRule ^(.*)epizy(.*)$ [L,R=301]

---------------- edit ------------------
I tried it and it didnt work, maybe I got it wrong ?

ive added this to my index.php file right at the top before anything else and now visiting redirects to which is still hosted at

// redirect browser to secure site if trying to browse insecure site
if(strpos($_SERVER['SERVER_NAME'], '') !== false)
	header("Location:", true, 301);

but im not sure if its possiible to redirect to

Im sorry, I know I keep asking questions and then finding solutions but I just scared of breaking something and dont like to risk things

I think you cannot redirect the homepage to another website. I did the same thing as you are doing once and my hosting was suspended. The person at support told me that I am not allowed to do this.

1 Like

RewriteRule matches based on URLs, not domain names. But you can do this with RewriteCond and the HTTP_HOST variable.


ah thanks admin, that makes sense

@yoptgyo I hope this its gonna be ok, my site is actually hosted at im just redirecting my subdomain name to my new domain name @, a lot of people know my site as epizy so im just trying to forward them to my new domain name in case they go to the old name

I guess the title is confusing, i’ll edit it again :slight_smile:

Here is what i use:

Redirect all pages: Redirect 301 /

Redirect a certain file to another site Redirect /path/to/old/file/old.html

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.