.htaccess redirect to ccgi server folder
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Plusnet Community
- :
- Forum
- :
- Help with my Plusnet services
- :
- Everything else
- :
- Re: .htaccess redirect to ccgi server folder
.htaccess redirect to ccgi server folder
04-09-2007 8:55 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
I'm trying to use our webspace on the ccgi server to host two different websites: http://www.domain1.co.uk and http://www.domain2.co.uk. I've had http://www.domain1.co.uk on the ccgi server for a while and recently registered http://www.domain2.co.uk. With some help from F9 support, the DNS records for both domains now point to the ccgi server. I've followed the suggestions on the PlusNet forum (http://portal.plus.net/central/forums/viewtopic.php?t=52576) to try using a .htaccess file to redirect requests to www.domain2.co.uk to a subfolder in the ccgi webspace but can't get this going at all. I don't get any errors at all - going to http://www.domain2.co.uk simply directs me to the http://www.domain1.co.uk site in the root space of the ccgi folder. It's as if the .htaccess file isn't even being accessed.
My .htaccess file looks like this:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.domain2.co.uk$ [nc]
RewriteRule (.*) /domain2/$1
Am I missing something here?
Thanks.
Re: .htaccess redirect to ccgi server folder
04-09-2007 1:48 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
And it works on my ccgi to have two different domains pointing to two different directories.
I understand, both domains point to ccgi, and all the Domain control settings have been made as outlined in the referenced threat in the old PN-forum.
You want http://www.domain1.co.uk to point to the directory1, which is directly in root of ccgi.
And http://www.domain2.co.uk shall similarly point to the directory2.
Your .htaccess file in root of ccgi should contain the following lines:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.domain1.co.uk$ [nc]
RewriteRule (.*) /directory1/$1
RewriteCond %{HTTP_HOST} ^www.domain2.co.uk$ [nc]
RewriteRule (.*) /directory2/$1
In case also the http://domain1.co.uk and http://domain2.co.uk shall point to these folders .htaccess in root should contain these lines instead (old forum entry: http://portal.plus.net/central/forums/viewtopic.php?t=52831):
RewriteEngine on
# domain1.co.uk to point to www.domain1.co.uk
RewriteCond %{HTTP_HOST} ^domain1.co.uk$ [nc]
RewriteRule ^(.*) http://www.%{HTTP_HOST}/$1 [R=301]
# www.domain1.co.uk to point to directory1
RewriteCond %{HTTP_HOST} ^www.domain1.co.uk$ [nc]
RewriteRule (.*) /directory1/$1
# ------------------------------------------------------------
# domain2.co.uk to point to www.domain2.co.uk
RewriteCond %{HTTP_HOST} ^domain2.co.uk$ [nc]
RewriteRule ^(.*) http://www.%{HTTP_HOST}/$1 [R=301]
# www.domain2.co.uk to point to directory2
RewriteCond %{HTTP_HOST} ^www.domain2.co.uk$ [nc]
RewriteRule (.*) /directory2/$1
This works with me. I am sure it can be refined or changed to whatever settings you prefer.
Remark to the Domain control settings, these can be a bit different as well to what I wrote in the old forum. Someone from PlusNet changed it to:
(Slightly edited)
Quote from: ffupi Found that somebody changed the entries of my first domain to:
Left field Type Pri Right field domain.tld. a 84.92.1.4 www a 84.92.1.4 mx 20 mx.last.plus.net.
And it still works.
Okey, so I did this now with the new domain as well.
And it works as well to point both the domain.tld and the www.domain.tld to root of ccgi. No clue what difference this makes on the net?
Re: .htaccess redirect to ccgi server folder
04-09-2007 2:58 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
I've tried both your code samples and have made a copy of the site hosted in the ccgi root folder into a sub folder on the ccgi server but neither code samples seem to do anything.
The domain records seem fine as going to to both domains with or without the "www." at the start takes me to the same site each time.
I'm not familiar with .htaccess files, does anyone know a way of testing that the code in the file is being executed?
Re: .htaccess redirect to ccgi server folder
04-09-2007 4:27 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Did you clear the cache in your browser? Press F5. Then surf again to domain1 and domain2.
Re: .htaccess redirect to ccgi server folder
04-09-2007 4:49 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
What I have noticed is that some content (images and output from some javascript) is missing when I have an .htaccess file with the rewrite code in it. If I then upload a blank .htaccess file in its place, the site displays properly. I don't know if that's significant or not?
Re: .htaccess redirect to ccgi server folder
04-09-2007 5:04 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
It took me several week as DIY to find the .htaccess code. It directs two domains into two subdirectories on ccgi-root. Any index.htm or index.php file in these subdirectories will display properly. I am using Joomla 1.5 and TYPO3 4.0 as two different cms in each subdirectory and there is no problems - all works fine.
I am not able to change the .htaccess for specific problems, and I am very unhappy that I did not find how to direct into a sub-subdirectory.
For to analyse your problem you would need to send me the domain names (private message e.g.). However, javascript etc. - no clue.
It could be that the original DNS is frame-wrapped by wherever it is registered and forwarded to PlusNet who then forwards to ccgi. This does not work, it needs to be a DNS redirect from the registration company.
Another possibility is, that the javascript searches things elsewhere but not in the subdirectory?
It could also be that the chmods are not set correctly, chmod=755 is always recommended by the BrightSparks.
You could e.g. rename the two subdirectories (for to keep safe for the time being), and create a new directory1 and directory2. Then put different index-files into directory1 and 2. Should the redirect then work and index file 1 and 2 show up on browsing to domain1.co.uk and domain2.co.uk, then it would be clear that the problem were elsewhere.
Does actually http://ccgi.username.plus.com/directory1 and http://ccgi.username.plus.com/directory2 work properly. This way it can always be checked if it would work without the DNS-.htaccess redirect of the domains.
Hope there is a clue for you what it could be?
Re: .htaccess redirect to ccgi server folder
04-09-2007 5:40 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Thanks for all your help with this - I didn't expect this to be so difficult to achieve!
I tried taking out the two sites and just creating two test folders: test1 and test2 with a simple index.html file in each one. I then added in an .htaccess file:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.domain1.co.uk$ [nc]
RewriteRule (.*) /test1/$1
RewriteCond %{HTTP_HOST} ^www.domain2.co.uk$ [nc]
RewriteRule (.*) /test2/$1
Trying to access either domain name I get a "500 Internal server error" error message. Trying to access the index.html files directly e.g. www.domain1.co.uk/test1/index.html I get the same "500 internal server error".
If I remove the code from the .htaccess file I can then access www.domain1.co.uk/test1/index.html succesfully.
To answer your other questions, the domain were registered through Force9 and I can access the sites by going to http://ccgi.username.force9.co.uk/folder1/, etc...
I'm not too concerned with the missing javascript and images, it just seems that everytime I try and place some code in the .htaccess file it screws up the site!
Thanks again.
Re: .htaccess redirect to ccgi server folder
04-09-2007 10:33 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
When this .htaccess is resident in root, can you then access http://ccgi.username.force9.co.uk/folder1/index.html and
http://ccgi.username.force9.co.uk/folder2/index.html ?
Then hidden question is, did you set the index.html to chmod=750 (or 755)? Error 500 has something to do with inaccessibilty of a file due to incorrect chmod settings. Has nothing to do with .htaccess.
Promise, it will work!
Re: .htaccess redirect to ccgi server folder
05-09-2007 9:13 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
I'm going to abandon this for now as I really need to get the site going. So I'm going to make some changes and go back to using the standard webspace for the second website for now.
Thanks very much for taking the time to help out
Re: .htaccess redirect to ccgi server folder
05-09-2007 9:45 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
That you can access the files correctly with
http://ccgi.username.force9.co.uk/folder1/index.html and
http://ccgi.username.force9.co.uk/folder2/index.html
shows that there is no chmod problem or else.
However, as .htaccess is correct I do not understand why you should not be able to access with
e.g. www.domain1.co.uk/index.thml and
e.g. www.domain2.co.uk/index.html .
This does not make sense.
It would mean that there is a cgi-error which does not allow .htaccess to work, I would rise a ticket.
Another thing I have not thought about: are there other .htaccess files in the subdirectories domain1 and/or domain2 ? These need of course to be adapted acording to whatever cms you use. In my case I needed to change the folder base/ or something for Joomla.
If you'd like give me the URLs per private message and I will surf to them and tell you what I think.
Re: .htaccess redirect to ccgi server folder
05-09-2007 10:13 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
http://aarronwalter.com/2007/01/15/running-two-domains-on-one-shared-hosting-server/
I'm not a big user of htaccess so don't know the ins and outs very well. Hope this helps
Re: .htaccess redirect to ccgi server folder
06-09-2007 8:58 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
If I need to move the site back onto the ccgi server I'll try and get support involved again but they actually suggested I try this forum for help when I initially asked about .htaccess files.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Plusnet Community
- :
- Forum
- :
- Help with my Plusnet services
- :
- Everything else
- :
- Re: .htaccess redirect to ccgi server folder