Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

.htaccess Redirection


  • Please log in to reply
1 reply to this topic

#1 Andrew

Andrew

    Bleepin' Night Watchman


  • Moderator
  • 8,250 posts
  • OFFLINE
  •  
  • Gender:Not Telling
  • Location:Right behind you
  • Local time:11:27 AM

Posted 27 February 2010 - 05:35 PM

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?

BC AdBot (Login to Remove)

 


#2 BabyGuard

BabyGuard

  • Members
  • 4 posts
  • OFFLINE
  •  
  • Location:Sunrise, FL
  • Local time:01:27 PM

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!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users