Tech
Infected

Linux, OpenSource, Programming And Hacks

Dec 5, 2017

Place a static file in root directory in Apache Server

Dec 5, 2017
Sometimes you are required to place files like sitemaps or other files in the root location.

Specially while using frameworks like Django, It can be bit tricky to do so within the framework.. So this method will flawlessly irrespective of which framework you are using.

So, If you are running Apache server, it's quite easy

Just open up your Apache Config file and add the following line at the bottom of that file.

Alias /example.txt /path/to/example.txt

Now restart your apache server.

After this you can access the file kept at /path/to/example.txt as /example.txt

Quite easy!

In ubuntu 16.04 you can find the config file here: /etc/apache2/apache2.conf






No comments:

Post a Comment