Hi guys, I just want to redirect the subdirectory to a subdomain, any help needed asap. e.g. http://www.domain.com/dir to http://dir.domain.com Or http://domain.com/dir to http://dir.domain.com Thanks!
i don't know about doing this with htaccess, but in PHP its pretty easy. Grab subdirectory, append to front of url, redirect to that new url.
RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ([a-z0-9-]+)/? http://$1.domain.com [R=301,NC,L] Replace both instances of "domain.com" with your domain name.
I have a page: www.mydomain.com/member.php?id=11&name=john and I need it: http://john.mydomain.com any help appreciated
This should do it Redirect /member.php?id=11&name=john http://john.mydomain.com You can also redirect a sub domain to a page on your main site RewriteCond %{HTTP_HOST} ^example.yourdomain.co.uk$ [NC] RewriteRule (.*) http://www.yourdomain.co.uk/your-page/$1 [R=301,L] The $ conditions on the end will redirect something like example.yourdomain.co.uk/this-page to yourdomain.co.uk/your-page/this-page this is very useful if you move a sub domain to your main site. I had do this for a client.