I apologize ahead of time that this might be a common question, however I've spent 3-4 hours already on solutions which don't quite fix the problem.
I have a site and it is moving to a different domain, the problem is--the site is paired with software which looks for: http://site/version
. Using a simple 301 redirect won't work because it'll get '301 Moved Permanently' instead of the actual data. So I thought.. ok--I made version.php
which has:
<? echo file_get_contents('http://newsite/version'); ?>
So the idea is simple: When one requests http://site/version
, give them http://site/version.php
, else: redirect everything to http://newsite/$1
What I got was something like this:
RewriteEngine On
RewriteBase /
RewriteRule ^/version$ /version.php
RewriteCond %{HTTP_HOST} site\.com$ [NC]
RewriteCond %{REQUEST_URI} !^version$
RewriteRule ^(.*)$ http://newsite.com/$1 [R=301]
I am no master at mod_rewrite rules, this is just what I hacked together and it doesn't work or I wouldn't be here. If someone who knows them better than I can help, I'd be very grateful. Thank you in advance.
site
andnewsite
are hosted at the same place - one is a parked domain on the other?%{HTTP_HOST}
, since it will always besite.com
, and theseRewriteCond
directives can be removed.