Solved

running files from subdomain but show main domain in browser

Posted on 2008-06-10
5
192 Views
Last Modified: 2010-03-04
Hi
i want to put 3 different application on 3 different subdomains.
For example:
sub1.domain.com,
sub2.domain.com,
sub3.domain.com

and i have 3 parked domain(d1.com, d2.com and d3.com) that point to root of www.domain.com

can i configure the apache .htaccess on the root folder to process files from subdomains using the rules:
if d1.com/file1.php is requested to execute sub1.domain.com/file1.php but to show d1.com/file1.php in the browser addressbar.

Is this possible to to using rewrite rules or something?

Thanks for your time.
0
Comment
Question by:kzdown
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 1

Expert Comment

by:dankuck
ID: 21756580
The VirtualHost directive allows you to set up the three different subdomains on a single machine (if that's what you're looking for).

The ServerAlias directive allows you to associate the same VirtualHost server with several different domain names.

Check the manual for more about those directives: http://httpd.apache.org/docs/2.2/

Is this what you're trying to do?
0
 

Author Comment

by:kzdown
ID: 21799214
i have read the manual, but im not able to write the right config file. Its hard for me as i have no expirience in this area. Can you please write an example?
i have tried with the following(paths are ok)::
<VirtualHost>
ServerName www.d1.com
DocumentRoot /www/sub1
ScriptAlias /cgi-bin/ /www/sub1.com/cgi-bin
</VirtualHost>

Thanks
0
 
LVL 1

Expert Comment

by:dankuck
ID: 21803336
My mistake.  I missed the fact that you want to do this in an htaccess file.  The <VirtualHost> directive will not work in htaccess according to the manual (probably because htaccess works on a per-access basis and virtual hosts must be set up when the server starts).  You must put them in the main configuration.  Because you're asking this question I'm assuming you don't have access to the main configuration.

If you can alter the htaccess rules of the default domain then you can use rewrite rules, but I'm guessing that if you could do that you'd probably have access to the main configuration and be able to use VirtualHosts.
0
 

Author Comment

by:kzdown
ID: 21804439
yes. i dont have access to main config files. Thats why i needed solution in .htaccess file (using rewriting rules) which can be placed in any folder.
0
 
LVL 1

Accepted Solution

by:
dankuck earned 200 total points
ID: 21809950
Without a VirtualHost directive in the main config, each domain will use the default config and so none of the .htaccess files would be accessed.
0

Featured Post

Free NetCrunch network monitor licenses!

Only on Experts-Exchange: Sign-up for a free-trial and we'll send you your permanent license!

Here is what you get: 30 Nodes | Unlimited Sensors | No Time Restrictions | Absolutely FREE!

Act now. This offer ends July 14, 2017.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

690 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question