MyBB Community Forums

Full Version: htaccess help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.
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
Change the root directory in the .htaccess in folder1.
(2011-07-11, 02:00 PM)Alex Smith Wrote: [ -> ]Change the root directory in the .htaccess in folder1.

I want to change the domain root to folder1. i have already changed the root folder for the domain to folder1, now my concern is about duplicate content, because now mydomain.com\some_thread provide same content as mydomain.com\folder1\some_thread.
Set up 301 redirects in the domain root.
(2011-07-11, 04:37 PM)Alex Smith Wrote: [ -> ]Set up 301 redirects in the domain root.

if I do that it gets into infinite redirect loop..
It'll be much easier just to use a DNS record. (CNAME)
(2011-07-11, 06:49 PM)pyridine Wrote: [ -> ]It'll be much easier just to use a DNS record. (CNAME)

I wanna change the root directory not server..
You're thinking of an A record... CNAMEs direct the domain to a specific directory.
(2011-07-12, 04:15 AM)pyridine Wrote: [ -> ]You're thinking of an A record... CNAMEs direct the domain to a specific directory.

No it does not.
read this: http://en.wikipedia.org/wiki/CNAME_record
Wow, I have no idea where I got that from, then. I honestly thought that's what CNAMEs did, but I apparently got them mixed up with something else. (Still trying to think of what it might have been) Sorry for misleading you.