How to make subdirectory the document root of a web domain or localhost
Posted
by
Ben Huh
on Server Fault
See other posts from Server Fault
or by Ben Huh
Published on 2012-04-15T07:51:25Z
Indexed on
2012/04/15
11:34 UTC
Read the original article
Hit count: 292
mod-rewrite
|httpd-conf
I have a subdirectory abc
in the document root /var/www/html
I want to be able to run any file any_file.html
within the subdirectory by typing in the browser:
localhost/any_file
instead of localhost/abc/any_file.html
or
my_domain.com/any_file
instead of my_domain.com/abc/any_file.html
I tried writing in httpd.conf
:
<Directory "/var/www/html/abc">
RewriteEngine On
RewriteBase /
RewriteRule %{REQUEST_FILENAME} %{REQUEST_FILENAME}\.html
</Directory>
But it doesn't work. Options FollowSymLinks
is activated in <Directory>
so I believe I would not need to write this again. Does anyone knows why and how to solve it? Thanks.
Update: I have another subdirectory efg
which I need to be able to access through localhost.
© Server Fault or respective owner