Ricky. Posted July 13, 2008 Share Posted July 13, 2008 I have my site at www.domain.com/subfolder/ hence I want www.domain.com to 301 redirect to /subfolder Also, domain.com to /subfolder Earlier I was using this simple redirect 301 /index.php http://www.domain.com/subfolder/ But it was causing problem as www. and without www it was looking different as well as no subdomain was working as it was also getting redirected to www.domain.com/subfolder Then I used this : RewriteCond %{HTTP_HOST} !^subdomain1\.domain\.com RewriteCond %{HTTP_HOST} !^subdomain2\.domain\.com Rewriterule ^(.*)$ http://www.domain.com/subfolder/$1 [r=301,nc] Now, with above, subdomain1.domain.com, subdomain2.domain.com are working fine but it is also redirecting any other folder than /subfolder to www.domain.com/subfolder .. ie. if someone tries to access www.domain.com/anothersubfolder then it is getting redirect to www.domain.com/subfolder Any help is greatly appreciated .. PS: This 301 redirect stuff has really messed my sites ranking as for main keywords its gone to 5th 6th pags from no.1 position .. Quote Link to comment Share on other sites More sharing options...
dannyb785 Posted July 13, 2008 Share Posted July 13, 2008 for one of my sites, I have www.domain.com redirect to www.domain.com/main.php so I have a file index.php and all it has on it is: <?php header("Location: main.php"); ?> There are other ways to do what you need, but to me, this is the easiest. and you can easily modify where it redirects by editing this file. Note: if you have an index.htm page, you probably won't be able to know if going to domain.com will access index.htm or index.php so basically, I suggest checking your root directory for any other file named index Quote Link to comment Share on other sites More sharing options...
Ricky. Posted July 13, 2008 Author Share Posted July 13, 2008 Hi Danny, that is good that you suggested it but my need are different, I need to 301 redirect forum root to subfolder , its not just a file. Also, I want to take care about conical name.. ie. I want all none www name to redirect to www version too. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.