cancel
Showing results for 
Search instead for 
Did you mean: 

More domain directing woes

geraldholdswort
Grafter
Posts: 26
Registered: ‎09-10-2008

More domain directing woes

OK, so I've got all four of my domains pointing at ccgi.<username>.free-online.co.uk, and the .htaccess works OK (BTW, if you have a index.php in the root, it runs that instead of looking at the .htaccess file!!!).
Now the problem is, that when I enter one of my domains into either IE or Firefox, the page comes up, but no graphics, no styles...just the PHP. If I were to click on one of the links to the graphics, I get an error 500. The sites work fine if I were to enter ccgi.<username>.free-online.co.uk/<folder>.
The .htaccess file only contains the redirection. Should there be other code in there (as I just uploaded my own, because I could not see if there were any originally there!!!)?
5 REPLIES 5
spraxyt
Superuser
Superuser
Posts: 10,063
Thanks: 1,369
Fixes: 75
Registered: ‎06-04-2007

Re: More domain directing woes

When you say "just the PHP" do you mean the actual PHP code is displayed rather than executed?
The problem with graphics and styles missing sounds like a paths problem, losing track of where these are when redirected. Are you using relative or full file-paths to those? If relative you could try giving the full (local) path. If that works possibly rewriting some of the environment variables is needed - but that's uncharted territory for me.
David
prichardson
Grafter
Posts: 1,503
Thanks: 1
Registered: ‎05-04-2007

Re: More domain directing woes

It would be interesting  to see your htaccess file.
It sounds to be honest that the redirection within the htaccess is looping due to directory inheritance when it comes to the images, the the PHP output sounds rather odd and unexpected.
geraldholdswort
Grafter
Posts: 26
Registered: ‎09-10-2008

Re: More domain directing woes

The PHP is running in that it is producing the expected HTML. It is even finding the graphics (otherwise wouldn't put a place holder for them - I've written a function to only produce a <img src...> if the graphic exists). Each page is finding the next, when linked (via an <a href...>). All references to all files are relative.
The .htaccess looks like:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.domain1.co.uk$ [nc]
RewriteRule (.*) /folder1/$1
RewriteCond %{HTTP_HOST} ^www.domain2.co.uk$ [nc]
RewriteRule (.*) /folder2/$1
RewriteCond %{HTTP_HOST} ^www.domain3.co.uk$ [nc]
RewriteRule (.*) /folder3/$1
RewriteCond %{HTTP_HOST} ^www.domain4.co.uk$ [nc]
RewriteRule (.*) /folder4/$1
I've even tried adding AddType image/gif .gif
Cheers,
Gerald.
Gabe
Community Veteran
Posts: 767
Registered: ‎29-10-2008

Re: More domain directing woes

Try:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.domain1.co.uk$ [nc]
RewriteCond %{REQUEST_URI} !^/folder1/
RewriteRule (.*) /folder1/$1
RewriteCond %{HTTP_HOST} ^www.domain2.co.uk$ [nc]
RewriteCond %{REQUEST_URI} !^/folder2/
RewriteRule (.*) /folder2/$1
RewriteCond %{HTTP_HOST} ^www.domain3.co.uk$ [nc]
RewriteCond %{REQUEST_URI} !^/folder3/
RewriteRule (.*) /folder3/$1
RewriteCond %{HTTP_HOST} ^www.domain4.co.uk$ [nc]
RewriteCond %{REQUEST_URI} !^/folder4/
RewriteRule (.*) /folder4/$1

That would be the standard way of rewriting to a subfolder. I'm not sure why <a href="http://community.plus.net/forum/index.php/topic,46224.msg392755.html#msg392755">this thread</a> suggested removing the second condition.
Boxersoft recently pointed out that this sort of rewrite has an unwanted interaction with the trailing slash problem. You can find a fix for that <a href="http://community.plus.net/forum/index.php/topic,82089.msg674617.html#msg674617">here</a>.
Gabe
geraldholdswort
Grafter
Posts: 26
Registered: ‎09-10-2008

Re: More domain directing woes

Excellent - that works fine. Thanks.
I've even added the bit about the trailing slashes.