I'm currently using this in my htaccess so when a user inputs "school.com", it will redirect them to "http://www.school.com/".
RewriteEngine on RewriteCond %{HTTP_HOST} school.com RewriteRule (.*)$ http://www.school.com/$1 [R=301]
I now have a subdomain and I want the same thing to happen when a user inputs "class.school.com" to redirect to "http://www.class.school.com/"
RewriteEngine on RewriteCond %{HTTP_HOST} class.school.com RewriteRule (.*)$ http://www.class.school.com/$1 [R=301]
The problem is it won't redirect it and it'll land on "http://class.school.com/" with a 'Page Not Found'. How would this be possible?
Is http://www.class.school.com an actual subdomain?
Maybe this will help ya: http://www.ilovejackdaniels.com/mod_rewrite_cheat_sheet.png
Yes, the http://www.class.school.com is an actual subdomain
If I remember correctly, .htaccess rules get processed top-down, so try setting it like this:
RewriteEngine on RewriteRule ^(.*)$ http://www.class.school.com/$1 [R=301] RewriteCond %{HTTP_HOST} ^class.school.com