Problems
The problem I'm having is getting the VirtualHost to work right. This is how I have the two setup:
<VirtualHost *:80>
DocumentRoot "/Apps/XAMPP/htdocs"
ServerName wrks.tk
ErrorLog "/Logs/Workarea/Error.log"
CustomLog "/Logs/Workarea/Access.log" common
<Directory "/Apps/XAMPP/htdocs/Workspace">
AllowOverride all
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/Apps/XAMPP/htdocs/REDIR"
ServerName www.wrks.tk
<Directory "/Apps/XAMPP/htdocs/REDIR">
AllowOverride all
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
What this is supposed you do is redirect if you connect to http://www.wrks.tk/
to http://wrks.tk/
but for some reason, http://www.wrks.tk
loads the same exact homepage as http://wrks.tk/
(instead of redirecting like it's supposed too). But as you can see both virtual hosts are pointed to a different directory:
/Apps/XAMPP/htdocs
(The real Homepage) is what http://wrks.tk loads
/Apps/XAMPP/htdocs/REDIR
(Redirection page) it's supposed to redirect http://www.wrks.tk
to http://wrks.tk
. This is what I have in the file:
<html>
<body>
<script>window.location.replace("http://wrks.tk/");</script>
<h1 style="text-align: center;">Redirecting you to the correct link</h1>
</body>
</html>
A simple redirect script, but instead of doing that, it just loads the homepage.
Attempts of Solution
- Emptying cache
- Restarting Apache multiple times
- Checking the error log (Didn't have any errors that helped)
But, none of these solve my problem, which is why I'm asking this question now.
Apologies for any confusion, the very-similar links make it confusing to understand and read.
But to explain it better,
Connect to http://google.com/ and notice how it redirects you to http://www.google.com/
What I want is basically the opposite, but the VirtualHosts aren't letting me do that.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…