Redirect a TXT file?

CLOSED

Redirect a TXT file?

Postby awatson » Mon Dec 27, 2010 1:51 pm

I have a simple text file on my web site that my programs download to obtain version information:

Code: Select all
GET  http://www.mountain-software.com/demos/versions.txt


I would like to replace this with a new file, and redirect requests for the above file to the new one at:

Code: Select all
www.mountain-software.com/version_info.ini


I tried doing this with a Rewrite command in my htaccess file:

Code: Select all
RewriteEngine On
RewriteCond %{HTTP_HOST} ^mountain-software\.com [nc]
RewriteRule (.*) http://www.mountain-software.com/$1 [R=301,L]
Redirect 301 /demos/versions.txt http://www.mountain-software.com/version_info.ini

Unfortunately, instead of receiving the contents of the version_info.ini file, my programs receive this:

Code: Select all
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="http://www.mountain-software.com/version_info.ini">here</a>.</p>
</body></html>


Eventually, I will update my programs to reference the new file, but I don't want to leave both old and new files in place to prevent breaking old versions of my programs.

Is there a way to make this work properly (get the version_info.ini file anytime the versions.txt file is requested)?

Thanks,

Anthony
awatson
 
Posts: 5
Joined: Tue Jun 13, 2006 9:59 am

Re: Redirect a TXT file?

Postby awatson » Tue Dec 28, 2010 7:06 am

Figured it out on my own. Turns out the solution is rather simple:

Code: Select all
RewriteRule ^demos/versions\.txt$ version_info.ini


Thanks,

Anthony
awatson
 
Posts: 5
Joined: Tue Jun 13, 2006 9:59 am


Return to New Threads/Problems

Who is online

Users browsing this forum: No registered users and 2 guests

cron