Jamesking56 Posted June 2, 2010 Share Posted June 2, 2010 Hi!Can someone write a .htaccess file for me please?I need it so that:it forces www on my main domain (force www.domain.com)then, for each subdomain it forces that subdomain (e.g. force community.domain.com over domain.com/community)can someone write this please and teach me how I can add more for more subdomains? Link to comment Share on other sites More sharing options...
real_illusions Posted June 2, 2010 Share Posted June 2, 2010 For the non-www to www:RewriteEngine OnRewriteCond %{HTTP_HOST} ^example.com [NC]RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]For the subdomains and subfolders.You can could use redirects, although this one is a permanent 301 redirect:Redirect 301 /oldfolder/ http://subdomain.example.comThen just repeat for each subfolder/subdomain.Hope that helps Link to comment Share on other sites More sharing options...
Jamesking56 Posted June 2, 2010 Author Share Posted June 2, 2010 I think the code it conflicting...Here is my .htaccess:Options -IndexesRedirect 301 /code/ http://code.horizon.uk.toRedirect 301 /community/ http://community.horizon.uk.toRedirect 301 /live/ http://live.horizon.uk.toRewriteEngine onRewriteCond %{HTTP_HOST} !^www.horizon.uk.to$RewriteRule ^(.*)$ http://www.horizon.uk.to/$1 [R=301]RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule . /index.php [L] The other parts are to force www and bits for wordpress permalinking...How can I make this work? UPDATE: I've sorted it, if anyone wants the solution then reply below. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.