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 doesn't work in virtualhost block | 
 |   
| Author | 
  | 
 
Qmpeltaty
 
 
  Joined: 06 Feb 2008 Posts: 182 Location: Poland
  | 
 Posted: Wed 08 Feb '17 17:45    Post subject: Rewrite doesn't work in virtualhost block | 
     | 
 
  | 
 
Hello
 
 
I have a simple rewrite 
 
 
 	  | Code: | 	 		  RewriteEngine On
 
RewriteRule ^$ /start [L,R=301]
 
 | 	  
 
which rewrite all users entering the page to /start alias. When i put it inside virtualhost block the rewrite doesn't work. When i put it into .htaccess file and place it in the DocumentRoot directory it works as expected. What could be the reason ? | 
 
  | 
 
| Back to top | 
 | 
 
James Blond Moderator
  
  Joined: 19 Jan 2006 Posts: 7443 Location: EU, Germany, Next to Hamburg
  | 
 Posted: Fri 10 Feb '17 18:27    Post subject:  | 
     | 
 
  | 
 
| Put the rewrite rule in the <Directory> block of your document root. | 
 
  | 
 
| Back to top | 
 | 
 
 
 
 
 | 
 
 
 |  
 
 |  
  |   
 |