Jump to content

Recommended Posts

Posted (edited)

Hi guys

 

I am having some issues with a website redirect.

 

Current I have the following set on the host of newdomain.org.uk:

RewriteEngine On
RewriteRule ^.*$ http://www.[i]olddomain[/i].kent.sch.uk [R=301]

So newdomain.org.uk redirects to olddomain.kent.sch.uk - all working fine.

 

My issue is that I have a subdomain that I do not want to redirect. I need it so that http://newdomain.org.uk/ and http://www.newdomain.org.uk/ redirect to http://www.olddomain.kent.sch.uk but http://subdomain.newdomain.org.uk does not redirect.

 

Would anyone be able to redirect me in the right direction, please? pun intended

 

Thank you

Edited by MisterTechMan
Posted

RewriteEngine On
# Redirect anything except subdomain.newdomain.org.uk
RewriteCond %{HTTP_HOST} !^(subdomain)\.newdomain\.org\.uk$ [NC]
# Redirect to http://www.olddomain.kent.sch.uk
RewriteRule ^.*$ http://www.olddomain.kent.sch.uk [R=301]

 

You can add multiple subdomains inside the brackets of the RewriteCond like so

 

RewriteCond %{HTTP_HOST} !^(subdomain)\.newdomain\.org\.uk$ [NC]

 

Hope it helps

  • Thanks 2
  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...