Heal Your Church WebSite

Teaching, rebuking, correcting & training in righteous web design.

Son of Not So Simple Redirect

Some good email going back-n-forth on this redirect issue. The funniest being NZ’s reply to one of us who said “work through your service provider” to which he responded with a very politely worded version of “duh!” Sometimes we geeks tend to throw stuff out there like spagetti – these last few pieces sliding down the wall under the category of “stating the obvious.”

Grins’n’giggles aside, I wanted to cover some of the information that has been exchanged. Keith Devens writes: “Just for reference, here’s the mod_write redirect, but it’s expensive because
Apache has to do a sub-request on every request. It’s basically something like
(this assumes they’re on different servers):

RewriteEngine on
RewriteCond %{HTTP_HOST} wmdi.com
RewriteRule . http://www.truthlaidbear.com/blogmd/%{REQUEST_URI}

Anders Jacobsen adds I’ve used Apache redirect a lot myself, and it works like a charm.

Keith; the solution you are proposing is very ISP specific, and if they make it that easy for you to set up virtual hosts (at no extra charge) something makes me think that they aren’t using “Real” virtual hosting (i.e. separate IPs for all virtual hosts). I use pair.com, and an explanation of their policy can be found here…

I personally have been so busy with my ‘real job’ that I haven’t had a chance to test out these various approaches – or some variation on a theme. Though I did have some redirect fun at the expense of an individual who has been harassing a member of Redland Baptist Church. This individual, frustrated by the court system, has linked some pages of Redland’s website – why? I don’t know. Though we were recently spammed. Perhaps that same someone wants others to do the same? Regardless, because the RBC site implements Server Side Includes, I have been able to take any traffic from identifiable ‘hate pages’ and give them an entirely different message. Here’s an example from the staff/contacts page at RBC

<!–#if expr=”($HTTP_REFERER = /ImaBigJerk\.com/) ” –>
<h4>All inquiries via the Big Jerk should be referred to our attorney at …
<!–#else –>
<!–#include virtual=”/includes/contactinfo.shtml” –>
<!–#endif –>

I’m going to return to this issue later this week when I figure out a solution, but until then, here are some resources you may find useful in your quest to redirect:

In the meantime, try tinkering with the following that I found via the support page at Prestwood.com – as this is where I’m going to start once I get some free time:

RewriteEngine On
Options +FollowSymlinks
RewriteBase /
# Rewrite Rule for machine.domain-name.net
RewriteCond %{HTTP_HOST} machine.domain-name.net$
RewriteCond %{REQUEST_URI} !machine/
RewriteRule ^(.*)$ machine/$1
… The Israelites are wandering around the land in confusion … Exodus 14:3

One Comment

  1. OK, folks, here’s an update on progress. I’m starting to think “close” might be good enough. Everything is working perfectly now, with a few minor exceptions:

    1) I created a .htaccess file in public_html (my web root) as per Dean’s instructions, with the following:

    RewriteEngine On
    Options +FollowSymlinks
    RewriteBase /
    # Rewrite Rule for http://www.wmdi.org
    RewriteCond %{HTTP_HOST} http://www.wmdi.org$
    RewriteCond %{REQUEST_URI} !blogmd/
    RewriteRule ^(.*)$ blogmd/$1
    DirectoryIndex index.html

    2) I added a simple .htaccess file in public_html/blogmd with “DirectoryIndex index.html” in it. This fixed an odd error that I was sometimes receiving where upon requesting “www.wmdi.org” an error that stated “file / not found” would be received by a user.

    3) I updated all the MT and phpBB parameters so that they show http://www.wmdi.org now. The only spot they give the game away is if you hover on the MT comments / trackback buttons, they show truthlaidbear.com . I think the reason for this is the shared configuration with TTLB; MT uses the same CGI directory for every blog. But this is very minor, so I don’t think I care.

    The only remaining “bug” that I still can’t figure out is that when you type “www.wmdi.org/forum” into your browser, you get to the front page of the forums properly — but you see “www.truthlaidbear.com/blogmd/forum” in your browser. If you type “www.wmdi.org/forum/index.php”, it works perfectly. I tried placing a .htaccess file in /public_html/blogmd/forum with “DirectoryIndex index.php”, but this had no effect. This isn’t a terribly big deal, though, as anyone coming from the front page of the WMDI site will see everything properly.

    Anyway, I am about ready to declare victory here, but if anyone has a suggestion on how to solve the http://www.wmdi.org/forum issue, chime in anytime!

    Thanks to everyone for their help…