MisterTechMan Posted October 12, 2018 Posted October 12, 2018 (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 October 12, 2018 by MisterTechMan
stevec_ Posted October 15, 2018 Posted October 15, 2018 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 2
MisterTechMan Posted October 16, 2018 Author Posted October 16, 2018 You are amazing - thank you very much for your help.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now