Apache .htaccess question

jagga

Member
Sep 20, 2002
109
0
0
Hi all
I want to set up some url redirection using the .htaccess file. I know I can use the 'mod_rewrite' module; but I am having some difficulty following the manual. I was hoping I can get one of the smart people here to help me.

I have 2 problems

1) I want to redirect a 'folder.domain.com' address to 'www.domain.com/folder'.

2) I want to redirect a 'www.domain.com/folder2' to 'folder2.domain.com'.

Thanks in advance.
 

jagga

Member
Sep 20, 2002
109
0
0
I wrote:


<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^(www\.)?jatshergill\.com$ [NC]
RewriteCond %{HTTP_HOST}<->%{REQUEST_URI} ^(www\.)?([^.]+).*<->/([^/]+) [NC]
RewriteCond %2<->%3 !^(.*)<->\1$ [NC]
RewriteRule ^(.+) /%2/$1 [L]
</IfModule>

in my .htaccess file.. but that did not seem to do the trick :(