Helpful Information
 
 
Category: Apache Development
mod_rewrite reg expression coding

I've been through the apache doc and can't quite nail this one down.
I'm trying to have my .htaccess send different domain names to different places.

scalenet.com is the main domain, but lab-balances.com goes to the same IP. If the user types in lab-balances.com/stuff/someotherstuff.html I want it to go to that page on the scalenet server, which it currently does. but if the user types in just lab-balances.com I want it to go to a certain page, lab-balances.com/x/y/ not to the index page that scalenet.com goes to now.
Please, any help would be appreciated, this is what I have now (doesn't work)
# -FrontPage-

RewriteEngine On
Options +FollowSymlinks
RewriteBase /
Rewrite Rule for machine.domain-name.net
RewriteCond %{HTTP_HOST} lab-balances.com$
RewriteCond %{REQUEST_URI} !scales/type/2/
RewriteRule %0 lab-balances.com/scales/type/2/

DirectoryIndex index.php3
IndexIgnore .htaccess */.??* *~ *# */HEADER* */README*

ErrorDocument 404 /index.php3

RewriteEngine On
Options +FollowSymlinks
RewriteBase /
RewriteCond %{HTTP_HOST} ^lab-balances\.com$
RewriteCond %{REQUEST_URI} ^$
RewriteRule ^(.*) /server/path/to/lab-balances.com/scales/type/2/index.html

Note, this is internal redirect, which means user see http://lab-balances.com/ in location bar but apache internally launches your index.html from the above server path.

As for external redirect, assuming the docroot for lab-balances.com is /server/path/to/lab-balances.com, the user will see http://lab-balances.com/scales/type/2/index.html
To use external redirect, replace the bold with the following:
RewriteRule ^(.*) http://lab-balances.com/scales/type/2/index.html [R,L]

I haven't tested this though.










privacy (GDPR)