Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: htaccess - rewriterule (solved)



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]



On Jul 30, 2006, at 9:33 AM, Michael Ghilissen wrote:

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 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


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Web-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/web-dev/mg% 40unparalleledcommunications.com


This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Web-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/web-dev/email@hidden

This email sent to email@hidden
References: 
 >htaccess - rewriterule (From: Michael Ghilissen <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.