Keep Server Online
  
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
  
or
  
 
  
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
  
Thank You! Steffen
  
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
 |    |   
 | 
     Topic: rewrite issues | 
 |   
| Author | 
  | 
 
bullet2916
 
 
  Joined: 04 Dec 2016 Posts: 1 Location: US, Mobile
  | 
 Posted: Mon 05 Dec '16 0:05    Post subject: rewrite issues | 
     | 
 
  | 
 
I am trying to redirect accesses to a virtual host (main directory /) to another site, but I want requests for per user directories to remain on my server. In the <VirtualHost> directive I include
 
 
   RewriteEngine On
 
 
   RewriteRule /~user/ - [L]
 
 
   RewriteRule ^.*$ newsite [R=301,L]
 
 
When I try the request http://currentsite/~user/index.html, it serves from my server and http://currentsite redirects. However, http://currentsite/~user also redirects. How can I get the write to send requests to currentsite? Thanks. | 
 
  | 
 
| Back to top | 
 | 
 
James Blond Moderator
  
  Joined: 19 Jan 2006 Posts: 7442 Location: EU, Germany, Next to Hamburg
  | 
 Posted: Sat 10 Dec '16 13:16    Post subject:  | 
     | 
 
  | 
 
Remove that last / from your first rewrite rule. Otherwise http://currentsite/~user will not match the rule. 
 
 
I would change it to
 
 	  | Code: | 	 		  
 
RewriteRule ^/~user - [L] | 	 
  | 
 
  | 
 
| Back to top | 
 | 
 
 
 
 
 | 
 
 
 |  
 
 |  
  |   
 |