2011-07-11, 01:08 PM
I want to change the root directory of a domain using htaccess.
I want to change the root dir of mydomain.tld from htdoc to htdoc\folder1
all the files
I also want to prevent duplicate content.
I am using this rules in my htaccess, which works only for some url.
i kept the above htaccess file in htdoc and there is another htaccess(google seo`s htaccess) file inside folder1.
No the problem is when I go to mydomain.com\folder1\thread-title it redirects to mydomain.com\thread-title, which is what I want.
But if I go to mydomain.com\folder1\somephpfile.php it does not redirects to mydomain.com\somephpfile.php.
Any help regarding this matter is appreciated..
thanks
I want to change the root dir of mydomain.tld from htdoc to htdoc\folder1
all the files
I also want to prevent duplicate content.
I am using this rules in my htaccess, which works only for some url.
RewriteCond %{HTTP_HOST} ^(www.)?mydomain.com$
RewriteCond %{REQUEST_URI} !^/folder1/
RewriteCond /folder1/%{REQUEST_URI} -d
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ /folder1/$1/
RewriteCond %{HTTP_HOST} ^(www.)?mydomain.com$
RewriteCond %{REQUEST_URI} !^/folder1/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /folder1/$1
RewriteCond %{HTTP_HOST} ^(www.)?mydoamin.com$
RewriteRule ^(/)?$ /folder1/index.php [L]
RedirectMatch 301 ^/folder1/$ http://mydomain.com/
i kept the above htaccess file in htdoc and there is another htaccess(google seo`s htaccess) file inside folder1.
No the problem is when I go to mydomain.com\folder1\thread-title it redirects to mydomain.com\thread-title, which is what I want.
But if I go to mydomain.com\folder1\somephpfile.php it does not redirects to mydomain.com\somephpfile.php.
Any help regarding this matter is appreciated..
thanks