LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[Webdev] mod_rewrite question

[Webdev] mod_rewrite question

Ken Guest kguest at stockbyte.com
Thu Jan 16 12:30:08 GMT 2003


adam beecher wrote:

>>RewriteEngine on
>>RewriteCond   %{HTTP_HOST}                 ^www\.[^.]+\.mysite\.com$
>>RewriteRule   ^(.+)                        %{HTTP_HOST}$1          [C]
>>RewriteRule   ^www\.([^.]+)\.mysite\.com(.*)
>>    
>>
>http://www.mysite.com/users/sites/$1
>  
>
>>my problem is that i want the same effect if people leave out the 'www'
>>i've had no luck with it as i'm a bit useless really :-)
>>
>>    
>>
>Try this:
>
>RewriteEngine on
>RewriteCond %{HTTP_HOST} ^(www\.)?[^.]+\.mysite\.com$
>RewriteRule ^(.+)                        %{HTTP_HOST}$1          [C]
>RewriteRule ^www\.([^.]+)\.mysite\.com(.*) http://mysite.com/users/sites/$1
>
>  
>
So, to redirect the browser to another server when downloading images 
 would the following work (inside
a virtualhost declaration)?
eg when the browser asks for  http://www.guest.cx/images/family.png  I 
want it to be redirected to
http://images.guest.cx/images/family.png

Would the following work?

Rewrite Engine on
RewriteCond %{REQUEST_URI} ^/images
RewriteRule ^/images/(.*)$ http://images.guest.cx/images/$1 [R=301]

k.



________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs SkyScan
service. For more information on a proactive anti-virus service working
around the clock, around the globe, visit http://www.messagelabs.com
________________________________________________________________________



More information about the Webdev mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell