I'd like some help with some URL rewriting magic. I am having trouble modifying the Request_URI variable.
I would like to switch between two sites http://host.com/alpha and http://host.com/beta. They are both handled by the same php script. This script is http://host.com/index.php.
The index.php expects to be given a GET variable SITE
to tell it which site to display. It also uses the REQUEST_URI to determine which content to display. In order for this to work, the alpha or beta need to be removed from the original request. This is where I am stuck.
So the REQUEST_URI starts at /alpha/content/file and needs to become /content/file.
I've tried this using mod_rewrite in .htaccess:
RewriteCond %{REQUEST_URI} /(alpha|beta)(.*)
RewriteRule .* index.php?site=%1
index.php:
<?php
echo "Site: " . $_GET['site'] . "<br/>";
echo "Request_URI: " . $_SERVER['REQUEST_URI'] . "<br/>";
//get_html($_SERVER['REQUEST_URI']);
?>
I'm hoping to have better luck with Apache's SetEnvIf and Alias.
Any ideas on how to do this would be greatly appreciated. Thanks.