kzdown
asked on
running files from subdomain but show main domain in browser
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.
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.
ASKER
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
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
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.
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.
ASKER
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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?