htaccess Elite

.htaccess tutorial


All times are UTC [ DST ]





Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: I want to create a 'virtual hosting' situation
PostPosted: 30 Oct 2006 07:56 
Offline

Joined: 28 Oct 2006 07:37
Posts: 44
http://lists.apple.com/archives/web-dev/2006/Jul/msg00080.html

Quote:
Hi list,


I am struggling with the following problem. Could someone point me in the right direction with comments or suggestions?

I have a website (A.com) hosted at DNS 12.345.678.999. I want to create a 'virtual hosting' situation for a second website with its own URL (B.com) to be hosted at the same Apache server, along with the first website.

I have created a folder <siteB>, at the root of the server, which contains the website. I want to create an .htaccess document to 'rewrite' the requests for http://www.b.com AND b.com to go to that folder. I have tried with the following code, and many variations, but do not seem to get it right:

--
RewriteEngine On
Options +FollowSymlinks
RewriteBase /
RewriteCond %{HTTP_HOST} B.com$
RewriteCond %{REQUEST_URI} !siteB/
RewriteRule ^(.*)$ siteB/$1
--


I would like the redirection to be totally transparent to the user.


Thanks for your help,


Michael



Quote:
Hey, this seems to work well (.htaccess)!


RewriteEngine On
RewriteBase /


#--- A.com and B.com share the same DNS->IP
#--- All requests to B.com must be directed to the siteB folder
#--- Transparent to the user


RewriteCond %{HTTP_HOST} ^B.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.B.com$ [NC]
RewriteRule ^(.*)$ http://B.com/siteB/$1 [R]


#--- Handling of trailing slash issue with directories
#--- Works for A.com and B.com


RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ $1/ [L,R]


Top
 Profile  
 
 Post subject:
PostPosted: 15 Dec 2006 20:55 
Offline

Joined: 15 Dec 2006 20:51
Posts: 3
I have used this script in the .htaccess file and it shows in url http://www.ionescu.nlwww/ so it does not work for me ... yet! and if I try to input http://www.ionescu.nl/ionescu/ the url changes to :

http://ionescu.nl/ionescu/_/ionescu/_/i ... w/ionescu/

plzz help me out


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
cron
Powered by phpBB