Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

the following virtual host definition is working for an arbitrary url starting with "http://1.2.3.4:80/*"

<VirtualHost *:80>
     ServerName www.domain.com
     DocumentRoot /home/user/www/application/current/public
     <Directory /home/user/www/application/current/public>
         Order allow,deny
         Allow from all
     </Directory>
</VirtualHost>

How to rewrite this configuration so that it is applied only for url's starting with "http://1.2.3.4:80/user/*"

I tried "ServerPath /user", but it doesn't work...

Any ideas?

share|improve this question

migrated from stackoverflow.com Jan 23 '11 at 14:48

This question came from our site for professional and enthusiast programmers.

closed as off topic by danlefree Aug 31 '11 at 20:25

Questions on Webmasters Stack Exchange are expected to relate to webmastering within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

    
Webserver configuration questions are a better fit for ServerFault, however, this question deals with very basic mod_rewrite rules so Everything You Ever Wanted to Know about Mod_Rewrite Rules would be the best place to start. Closing as off topic - please see our FAQ or inquire at Meta if you have any questions regarding action taken. –  danlefree Aug 31 '11 at 20:25

2 Answers 2

Unfortunately, ServerPath is a legacy directive that is used to support HTTP/1.0 clients which don't support the Host: header. Therefore, an alternative is to have the primary vhost serve up a page with links using URL prefixes that Apache can use for routing.

For this legacy support mechanism to work, you need to disregard the Host header completely (since the browsers you need to support would not send one). So you can't use ServerName and ServerPath simultaneously.

I'd just use mod_rewrite to do what you want.

share|improve this answer

I'm sorry to say I can't answer your question directly but I am fascinated by it. I've been doing Apache support on various fora for 6 years and this is the first time I've seen a ServerPath question. What made you consider it?

It's such an old and disused feature that I suspect even ServerPath forgot ServerPath existed.

share|improve this answer