Forum Moderators: phranque
I'm pretty sure I've just got some flag wrong but I cant figure where... any help?
Options +FollowSymLinks
Options +SymlinksIfOwnerMatch
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^newdomain\.co.uk [NC]
RewriteRule ^.*$ [newdomain.co.uk%{REQUEST_URI}...] [R=permanent,L]
RewriteCond %{HTTP_HOST} ^www.newdomain.co.uk [NC]
RewriteRule ^.*$ [olddomain...] [L]
thats the code I'm using...
but when the user types in "www.newdomain.co.uk" I want it to show that, not re-direct and show www.olddomain.com/forumdir/
any suggestions? thanks :)
www.olddomain.com is what I use for my personal web-site, I started a forum the other day that has started to take off quite quickly and so I decided I'd get a new domain to point directly to the forum that is easier to remember than www.olddomain.com/theforumsname/
so technically yes both domains are pointing to the same server, but if someone is requesting www.newdomain.co.uk I want to filter that and take them to the forum, which it's now doing, but its displaying things like www.olddomain.com/theforumsname/index.php?showtopic=22
whereas I want it to display www.newdomain.com/index.php?showtopic=22 so basically I just don't want people to know that its on the same server as my personal web-site.
The reason I didn't go for a new host is because the web-host I'm with is a LOT cheaper than anyone else I've found and I have plenty of spare drive space and bandwidth.
A simple way to rephrase and answer my question is, "If you remove all rewrites related to /forumdir, can you currently access the forum directory as 'http://www.olddomain.co.uk/forumdir/' and as 'http://www.newdomain.co.uk/forumdir/'?"
If so, you should be able to use the following, unless there are other requirements outside what's been discussed:
Options +FollowSymLinks
RewriteEngine on
#
# Redirect newdomain to www.newdomain
RewriteCond %{HTTP_HOST} ^newdomain\.co\.uk [NC]
RewriteRule (.*) http://www.newdomain.co.uk/$1 [R=301,L]
#
# Rewrite all pages requested from newdomain to same-named pages in /forumdir/
# (Added RewriteCond to prevent infinite loop)
RewriteCond $1 !^forumdir/
RewriteCond %{HTTP_HOST) ^www\.newdomain\.co\.uk [NC]
RewriteRule (.*) /forumdir/$1 [L]
RewriteCond %{THE_REQUEST} \ /forumdir/
RewriteRule . - [F]
Jim