.htaccess redirect.

Soldato
Joined
28 Mar 2005
Posts
11,255
Location
Newbury
Not sure if this is how most people would do it, but it's how I do it on my site.

Create a blank index.html page and then use something like this in your .htaccess file.

Code:
redirect 301 /index.html http://www.orderoftheflame.co.uk/blog/
 
Soldato
Joined
26 Dec 2003
Posts
16,522
Location
London
OP, what do you mean by redirect? If you mean that, when someone requests the subdomain, you want content to load from the directory, then use cPanel; if you already have the subdomain set up, but want to have people who visit the subdomain forwarded to the directory (and have the directory appear in the address bars) then use the solution below.

Not sure if this is how most people would do it, but it's how I do it on my site.

Create a blank index.html page and then use something like this in your .htaccess file.

Code:
redirect 301 /index.html http://www.orderoftheflame.co.uk/blog/

Why bother creating a blank index file? Just do:

Code:
RedirectMatch ^/(.*)$ http://domain.com/folder/$1

…which gives the added benefit of redirecting, say, http://subdomain.domain.co.uk/foo to http://domain.co.uk/subdomain/foo
 
Back
Top Bottom