Link to home
Start Free TrialLog in
Avatar of Covaci Marian
Covaci Marian

asked on

How can i point a subdomain to directory?

It is possible to do this from htacces file? And how... thanks...
Avatar of Dr. Klahn
Dr. Klahn

Please describe the exact action and effect that you want so that we know how to approach the issue.

For example, "http://www.mydomain.com roots at /www/folder.  I want http://bucky.mydomain.com to root at /www/folder2."
Avatar of Covaci Marian

ASKER

I want to point the subdomain https://shop.exemple.com to folder htdocs/shop
I use xampp, and i tried with vhosts but the program says:

" Error: Apache shutdown unexpectedly.
This may be due to a blocked port, missing dependencies,
improper privileges, a crash, or a shutdown by another method.
Press the Logs button to view error logs and check
the Windows Event Viewer for more clues
If you need more help, copy and post this
entire log window on the forums "
 
The code in vhosts that i used is:

<VirtualHost *:80>
DocumentRoot “E:/SERVER-XAMPP/xampp/htdocs/subdomain”
ServerName subdomain.localhost
</VirtualHost>
ASKER CERTIFIED SOLUTION
Avatar of Dr. Klahn
Dr. Klahn

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Ok, but if i will make a www. and a costom. subdomain how can i define this in the same vhosts file... ?
Ok i see found how to make, thanks...
On my own system I "deprecate" the default server (this eliminates bots and scrapers trying to scan IP addresses en bloc), then add real, functioning vhosts as include files in the httpd.conf, as follows:

# ========================================================
#
#                 DEFAULT VIRTUAL HOST
#
# ========================================================


#
# IP address[:port] for name-based virtual hosts
#
NameVirtualHost *:80

#
# This VirtualHost is used for requests with no server name.
#
<VirtualHost *:80>

#
# Set default root and access allowed
#
DocumentRoot /www/localhost
<Directory /www/localhost>
  Order allow,deny
  Allow from all
  Options none
  AllowOverride none
</Directory>

#
# Send logging to trash
#
CustomLog /dev/null locallog

# Redirect any request to "no site here" file
RewriteEngine On
RewriteLogLevel 0
RewriteRule .* /standard.html [L]

</VirtualHost>


# ========================================================
#
#                 VIRTUAL HOST INCLUDES
#
# ========================================================


#
# 1: server1.(whatever)
#
Include conf/server1.conf


#
# 2: server2.com
#
Include conf/server2.conf

Open in new window