So I want to redirect certain requests which formerly went to www.example.com/Files/ to files.example.com/ while preserving the relative address of the request. what I mean is that a request to www.example.com/Files/xyz.zip would get redirected to files.example.com/bin/xyz.zip. I know how to do this by creating a redirect for each file, but I was hoping to be able to create a single rule that handles all files at once.
Any ideas?
Page 1 of 1
.htaccess Redirection Preserve file path, change subdomain
#1
Posted 27 February 2010 - 05:35 PM
Help us help you. If HelpBot replies, you MUST follow step 1 in its reply so we know you need help.
Boredom Software Stop Highlighting Things
Boredom Software Stop Highlighting Things
#2
Posted 05 March 2010 - 10:04 AM
Try adding the following code into your .htaccess file
RewriteEngine On
RewriteCond %{HTTP_HOST} !^(.*)\.example\.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
That is just a redirect code to make all non-www request point to the www.example.com domain. You may or may not be able to edit this to work the way you want it but that's something for you to try out. Good luck!
RewriteEngine On
RewriteCond %{HTTP_HOST} !^(.*)\.example\.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
That is just a redirect code to make all non-www request point to the www.example.com domain. You may or may not be able to edit this to work the way you want it but that's something for you to try out. Good luck!
Share this topic:
Page 1 of 1

Help



Back to top








