Forum Moderators: phranque
now I have www.domain2.com pointing to this domain1.com aswell.
now I want to have a rewrite rule that willl move requests for www.domain1.com/forum to the new domain, and look like either www.domain2.com or www.domain2.com/forum/
Any ideas? I'll post some of my attempts here later, I was able to do the first bit, so that www.domain2.com calls www.domain1.com/forum . I will post that once I get my FTP login working again.
My expertise is in CSS, so I am looking forward to helping some people out here in the future!
thanks,
pauls
To help in your efforts, you may want to look in the forum library [webmasterworld.com]. You can find a lot of interesting information about mod_rewrite there.
Lammert
#new from paul
# Rewrite xyz domain to subfolder
RewriteCond %{HTTP_HOST} ^www\.domain2\.com
RewriteCond %{REQUEST_URI}!/forum/
RewriteRule (.*) /forum/$1 [L]
#and for people who forget www
RewriteCond %{HTTP_HOST} ^domain2\.com
RewriteCond %{REQUEST_URI}!/forum/
RewriteRule (.*) /forum/$1 [L]
but now I want a redirect from domain1.com/forum to domain2.com or domain2.com/forum
I think this might create a infinite loop as they point to the same folder.
# Rewrite xyz domain or www.xyz domain to subfolder
RewriteCond %{HTTP_HOST} ^(www\.)?domain2\.com
RewriteCond %{REQUEST_URI} !/forum/
RewriteRule (.*) /forum/$1 [L]
Jim
A better solution to the missing www problem is to redirect from non-www to www -- or vice-versa. This also helps from an SEO perspective -- No use spreading your PageRank or link popularity accross what search engines see as two separate domains...
> but now I want a redirect from domain1.com/forum to domain2.com or domain2.com/forum
Redirect from domain1.com/forum to domain2, then let your internal rewrite take care of adding /forum on domain2. Otherwise, the /forum subdirectory path will be 'exposed' to users and to search engines. I don't think you'd want that.
Jim