Rewrite problems

Using a single web hosting account to host multiple sites

Postby DanUK » Sat Jan 19, 2008 7:39 pm

Hi again :) sorry, I just tried those, I must've overlooked it

The first one made no change, if I tried to request the site that has no files it still gives the same error and says "You don't have permission to access /www.site2.co.uk/ on this server." and trying to load another site from it works

The second piece of code got rid of the "You don't have permission to access /www.site2.co.uk/ on this server." and just put / instead, then then my working sites woudln't load, no images would load (which call /img/foo.jpg) so I guess it changed something there

The third (both together) reacted the same as above (second), but had the issue with the images too

Hope this helps somewhat? Once again, I appreciate the help.
DanUK
 
Posts: 7
Joined: Mon Dec 31, 2007 12:06 pm

Postby richardk » Mon Jan 21, 2008 11:08 am

If the domain is in the RewriteCond it's supposed to rewrite everything to the sub directory, right? This works fine for me. It cannot affect any other domains. Do you have any other mod_rewrite?
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST} ^(www\.)?(domaina\.com|domainb\.com|domainc\.com)$ [NC]
RewriteRule ^(www\.)?(domaina\.com|domainb\.com|domainc\.com)(/(.*))?$ http://www.$2/$4 [R=301,L]

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST} ^(www\.)?(domaina\.com|domainb\.com|domainc\.com)$ [NC]
RewriteRule ^(.*)$ /www.%2/$1 [QSA,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby DanUK » Mon Jan 21, 2008 3:19 pm

Hi, thanks for your continued support :)

I'll give that a shot

I even tried my host's help site -> http://help.titanhosts.net/index.htm?i/ ... riting.htm and the examples there end up the same, so very strange

No other mod_rewrite that i'm running, except it's a shared server

Thanks
DanUK
 
Posts: 7
Joined: Mon Dec 31, 2007 12:06 pm

Postby richardk » Mon Jan 21, 2008 3:52 pm

If you can't make their examples work you might want to contact them to see if they know why.

I did notice they are including the whole physical path, so you might need to add your document root in front of /www.%2/$1 like in their example.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Previous

Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 19 guests

cron