You are not logged in.
Hey all,
For some reason, I have the A records for domain benchall.com pointed to my VPS. Not my domain, no idea who owns it or why they're trying to host it on my server. Attempted contact with the registered owner has been futile. So, I've created it as a virtual host with short page asking the owner to fix their DNS, and then redirect to meatspin.com
Problem is, most of the requests going to this domain are for paths below the root such as images/star.gif /YouBench and various other CSS and image files.
What redirection rule can I put in apache to redirect ANY request for any path under www.benchall.com to /index.html?
eg, www.benchall.com/images/star.gif --> www.benchall.com
eg, www.benchall.com/YouBench/ --> www.benchall.com
eg, benchall.com/images/star.gif --> www.benchall.com
I've tried various versions of the below config, but they all result in a redirect loop
RewriteEngine On
RewriteCond %{HTTP_HOST} !^.*benchall\.com/index\.html$
RewriteRule ^(.*)$ http://www.benchall.com/index.html [R=permanent,L]
Last edited by fukawi2 (2009-02-18 00:48:27)
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
I have the same thing on one of my sites, but my last line is a little different:
RewriteRule (.*) http://wherever.com [R=301,L]
-mS
Offline
301 is a permanent redirect, so I think they'll do the same thing... I'll give it a shot without the anchoring on the regex though...
Nope
Redirect Loop
Firefox has detected that the server is redirecting the request for this address in a way that will never complete.
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
First of all, I would suggest that you remove the redirection to meatspin.com. I highly doubt that the domain you posted gets more than 10 visits/month, but meh, being ethical never hurt anyone.
Secondly, it would be more appropriate to issue a 503 error code which would indicate that the service provided on this domain is currently unavailable. You can do this with the following PHP script and .htaccess files:
index.php:
<?php header("HTTP/1.1 503 Service Unavailable"); ?>
<html>
<head>
<title>Unauathorized DNS</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<p align='center'>
This domain (benchall.com) has set their DNS to this host without authorization.
</p>
<p align='center'>
<b>If you are the owner of this domain, please update your DNS urgently to use correct DNS settings.</b>
</p>
</body>
</html>
.htaccess:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^(.*)$ /index.php [L]
</IfModule>
Offline
Sweet, that works foutrelis - thank you
I've added the 403 in, but I've left the redirection to meatspin, just because I'm a bastard
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
Off-topic, but I seem to have missed the point in time where everyone started closing HTML tags with /> instead of just >
Can someone explain to me why we have moved to this practice? I just don't get it, it doesn't seem to change anything apart from extra typing, which we all know if bad.
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
XHTML requires all tags be closed. This is not the case with HTML. The former has (mistakenly?) gained a lot of popularity in recent years, not sure how that came to be though. :>
Have a read at the wikipedia entry about XHTML for juicy details.
Offline
Cheers
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline