Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mod_rewrite not working with vhost.conf file

Status
Not open for further replies.

shobet

IS-IT--Management
Nov 27, 2008
2
GB
Hi, I've googled and searched the docs but have been unable to find an answer to my problem. I'm sure it's something simple I'm missing but my brain can't see it.

What I'm trying to do is the following:
I want the specific URL
to be rewritten to
but all other traffic to work as normal.

Here's a copy of the vhost.conf file I'm using.

<VirtualHost *:80>
ServerName # Rewrite
RewriteEngine On
RewriteCond %{SERVER_NAME} ^ RewriteRule ^/adirectory$ /some/other/directory [R]
ProxyPreserveHost On
ProxyPass / ProxyPassReverse / ErrorDocument 502 ErrorDocument 503 </VirtualHost>

The proxying works fine, but whatever I attempt I can't get the rewrite for that particular URL to work.

Any advice will be appreciated.
 

If you just want traffic to one directory to be redirected, it may be simpler to just put an htaccess file in that directory and send all traffic to the newdir. For example:

Code:
RewriteEngine on 
RewriteRule ^$ /newdir/

This way you don't have to mess with conditions or restart apache every time you want to try something different.


 
I was hoping to keeping it all within the vhost.conf file.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top