Forum Moderators: phranque
The domain register has the DNS records pointing to the server where the files are, and has web fowarding enabled to forward to (using the above example) [cgi.user.hoster.com...] (tried with and without a trailing /).
Have tried to get this to work with mod_rewrite in .htaccess in the root folder (ie cgi.user.hoster.com/) (note one is a .co.uk domain and the other a .org.uk domain):
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.site1.co.uk$ [NC]
RewriteCond %{REQUEST_URI}!^/site1/(.*) [NC]
RewriteRule ^(.*)$ /site1/$1 [L]
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.site2.org.uk$ [NC]
RewriteCond %{REQUEST_URI}!^/site2/(.*) [NC]
RewriteRule ^(.*)$ /site2/$1 [L]
Infuriatingly site1 seemed to work yesterday, today neither of them work...
Any help much appreciated.
Ask your host if you can use your domain with the site and how.
Maybe you can do it via cPanel, or other interface.
Maybe only the host can do it.
Possibly they don't offer that, at all.
You can test the configutation of the host by using telnet.
(Replace 123.123.123.123 with the real IP of the server.)
$ telnet 123.123.123.123 80
> GET / HTTP/1.0
> Host: www.site1.co.uk
>
If the virtualhost setting is there, this will show your site.
Otherwise, it will show default page of the host (or error page).
This is the problem. Go with a straight domain registration pointing to DNS servers which you can control by editing the DNS zone file, point your domain name straight to your server's IP address, and be done with it.
All this "domain forwarding" and "domain parking" is a waste of time, and has serious operational side-effects, the present problem being an example. It also has serious SEO implications, if every request to your domain results in a redirect or lands in a framed page.
Looking at the code itself, I'd suggest:
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?site1\.co\.uk [NC]
RewriteCond $1 !^site1/
RewriteRule (.*) /site1/$1 [L]
Jim
hoster.com won't let you edit DNS zones (they insist on doing it for you).
telnet got very confused leaving me very confused - and in effect confirming no virtual hosting, as I see it.
Quite agree about frames being nasty (I avoid them) and forwarding dreadful bandwidth and SEO etc - but needs must as in having the domains registered in one place and hosted in another.
Tried Jim's suggestions for .htaccess - still no luck.
What is confusing (and frustrating) me is that yesterday www.site1.co.uk worked ie showed as such in the address bar and the content at ccgi.user.hoster.com/site1 and today as I write there is another domain which I know is hosted elsewhere, forwarded, and shows content from hoster.com's cgi server, allbeit with some odd addressing, and all this without htaccess (and with frames involved!).
So it can be done - but how to make it reliable?