I have an Apache server hosted on an EC2 instance which points to a domain that I own. Now, what I essentially want to get done is that the web server should return a .json
file when the user tries to curl the domain.
eg. $curl mydomain.com
My 000-default.conf
file which is located in /etc/apache2/sites-available/
looks as follows. I've added the <Directory>
section to activate the .htaccess
file located in my /var/www/html
folder which is also the root of my website.
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<Directory /var/www/html/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
My .htaccess
file looks as follows:
RewriteEngine On
RewriteCo "%{HTTP_USER_AGENT}" curl
RewriteRule ^(.*)$ "/var/www/html/resume.json" [L,R=302]
My /var/www/html
directory looks something like this:
/.well-known
.htaccess
index.html
resume.json
I've gone through numerous examples and tutorials and have used bits and pieces from everywhere to reach so far as I need something specific to be done. Unfortunately, when I try to curl my domain I get returned by the following message.
C:\Users\example >curl example.com/
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>302 Found</title>
</head><body>
<h1>Found</h1>
<p>The document has moved <a href="https://example.com">here</a>.</p>
<hr>
<address>Apache/2.4.29 (Ubuntu) Server at example.com Port 80</address>
</body></html>
I would like to know what I'm doing wrong in terms of configuration that I cannot get the .json
displayed as it is on the terminal.