Forum Moderators: phranque

Message Too Old, No Replies

Two .htaccess subdomain commands at same site?

Redirecting to and from subdomains from and to folders

         

Lucas

10:43 pm on May 8, 2004 (gmt 0)

10+ Year Member



I already have this in my .htaccess file:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]

But I *also* want for visitors who access [example.com ] to be 301 redirected to [folder.example.com ].

Impossible?

W3C validates .html; who validates .htaccess?

gergoe

11:02 pm on May 8, 2004 (gmt 0)

10+ Year Member



just repeat the rewritecond and the rewriterule but with the modified patterns. like this: ^www\.example\.com/folder/(.*) [folder.example.com...]

you can put as many rules into the htaccess files as you want. i suggest you to read about the mod_rewrite in the apache manual, to have better understanding of what you're doing with these changes.