apache rewrite virtual host URL-hiding
Hi all, I have a porb with rewrite - after modifying httpd.conf and restarting apache nothing happened so i wondered if the config was read at all... but of course it may be just a fault of my rewrite rule. - Please have a look: I want to do: http://openspirit.de should be forwarded to the zope folder "noo", located in (zope-root)/openspirit/noo/ of my Zope server. I can use regular URL-forwarding, URL-hiding and rewrite-rules to achieve this. - It should be possible in some way ;) Because it didn't work that easy as i expected it tried to do it in small steps, just copied my old and working virtual host entry: # current rule, works, forward von DynDNS -> IP <VirtualHost openspirit.homelinux.net> ServerName openspirit.homelinux.net ServerAlias openspirit.homelinux.net RewriteEngine on RewriteLogLevel 1 RewriteRule ^/(.*)$ http://coforum.org:9080/VirtualHostBase/http/openspirit.homelinux.net:80/ope... [P] </VirtualHost> # new domain: http://openspirit.de, does not work; forwarding bzw. URL-hiding from a real hosting <VirtualHost openspirit.de> ServerName openspirit.de ServerAlias openspirit.de RewriteEngine on RewriteLogLevel 1 RewriteRule ^/(.*)$ http://coforum.org:9080/VirtualHostBase/http/openspirit.de:80/openspirit/Vir... [P] </VirtualHost> In both domain config menues i entered just the IP, so both adresses are analogues to each other: Maybe you alreday have an idea, how to do the complete thing - i would be so fair to use your solution unchanged ;-) Do i need URL-hiding in that case? IMO it's all possible with the ruels and i make the domain forwarded just to the IP. I guess URL-hiding is only for sites on free hosting serveices like geocities and so on, right? Have a nice day, Florian P.S. What's the difference between <VirtualHost openspirit.de> und ServerName openspirit.de Why is it there twice? -- Florian Konnertz --- http://www.florian-konnertz.de http://openspirit.homelinux.net/noowiki/FrontPage ZWiki about all topics, especially consciousness research and wisdom traditions
Hello, Florian..
# new domain: http://openspirit.de, does not work; forwarding bzw. URL-hiding from a real hosting <VirtualHost openspirit.de> ServerName openspirit.de ServerAlias openspirit.de RewriteEngine on RewriteLogLevel 1 RewriteRule ^/(.*)$
http://coforum.org:9080/VirtualHostBase/http/openspirit.de:80/openspirit/Vir tualHostRoot/$1 [P]
</VirtualHost>
Shouldn't it be something like this: NameVirtualHost * <VirtualHost *> ServerName openspirit.de # you don't need a ServerAlias if it's the same as ServerName RewriteEngine on RewriteLogLevel 1 ... rule for openspirit.de </VirtualHost> <VirtualHost *> ServerName openspirit.homelinux.net RewriteEngine on RewriteLogLevel 1 ... rule for openspirit.homelinux.net </VirtualHost> Setup like this works perfectly for me. Regards, alex. -- Aleksandar Radulovic a 13 x dot net http://a13x.net/ R.J. Oppenheimer: "I am become death, destroyer of worlds" (1945 AD)
Aleksandar Radulovic wrote:
Hello, Florian..
# new domain: http://openspirit.de, does not work; forwarding bzw. URL-hiding from a real hosting <VirtualHost openspirit.de> ServerName openspirit.de ServerAlias openspirit.de RewriteEngine on RewriteLogLevel 1 RewriteRule ^/(.*)$
http://coforum.org:9080/VirtualHostBase/http/openspirit.de:80/openspirit/Vir tualHostRoot/$1 [P]
</VirtualHost>
Shouldn't it be something like this:
NameVirtualHost *
<VirtualHost *> ServerName openspirit.de # you don't need a ServerAlias if it's the same as ServerName RewriteEngine on RewriteLogLevel 1 ... rule for openspirit.de </VirtualHost>
<VirtualHost *> ServerName openspirit.homelinux.net RewriteEngine on RewriteLogLevel 1 ... rule for openspirit.homelinux.net </VirtualHost>
Setup like this works perfectly for me.
Regards, alex.
Ok, i have seen it like this too, and also had it run once, but today in my case it's quite strange. - Of course i tried it as you said, but no success. I tracked down the prob a little bit: Changes in the conf.are applied after restart (of course); It's simply, that apache does not recognize, that the request comes from that domain AFAICS. I cannot find anything about it in the logs yet. Have to check apache docs further. http://openspirit.de leads to the parent directory of apache doc root, as if the vhost is not touched. :( Any other ideas are strongly appreciated. flo -- Florian Konnertz --- http://www.florian-konnertz.de http://openspirit.homelinux.net/noowiki/FrontPage ZWiki about all topics, especially consciousness research and wisdom traditions
Florian Konnertz wrote at 2003-7-17 15:05 +0200:
I have a porb with rewrite - after modifying httpd.conf and restarting apache nothing happened so i wondered if the config was read at all... but of course it may be just a fault of my rewrite rule. - Please have a look:
Do you know that you can log the actions of rewrite rules? Look at the "mod_rewrite" documentation, for details. Dieter
Dieter Maurer wrote:
Florian Konnertz wrote at 2003-7-17 15:05 +0200:
I have a porb with rewrite - after modifying httpd.conf and restarting apache nothing happened so i wondered if the config was read at all... but of course it may be just a fault of my rewrite rule. - Please have a look:
Do you know that you can log the actions of rewrite rules? Look at the "mod_rewrite" documentation, for details.
Dieter
Yes i know. - It is logged already: nothing happens... It's a VHost problem, my section is untouched, instead the default vh is taken, i still have no idea, why. I studied most of the vh manual, posted to the apache NG now. thx, Florian -- Florian Konnertz --- http://www.florian-konnertz.de http://openspirit.homelinux.net/noowiki/FrontPage ZWiki about all topics, especially consciousness research and wisdom traditions
Florian Konnertz wrote at 2003-7-22 01:17 +0200:
... It's a VHost problem, my section is untouched, instead the default vh is taken, i still have no idea, why. I studied most of the vh manual, posted to the apache NG now.
Did you define your "vhost"s name in "/etc/hosts". This is necessary that Apache considers your "vhost" definition as applicable (the IP address of the accepting socket must match your "vhost" name). Dieter
This could be something to do with the way you have defined your Virtual Host. Try the following: NameVirtualHost ip.address.goes.here <VirtualHost ip.address.goes.here> ServerName openspirit.homelinux.net If you cannot use the IP address for some reason, say you are using a dynamic dns server to host from a dialup account, you must use: NameVirtualHost * <VirtualHost *> ServerName openspirit.homelinux.net If Apache does not recognize the name of the virtual host, it will choose the first virtual host it comes across that matches the host IP address. Since you haven't specified an IP address in the latter case, the default virtual host will be the first one listed. Kevin Florian Konnertz wrote:
Hi all,
I have a porb with rewrite - after modifying httpd.conf and restarting apache nothing happened so i wondered if the config was read at all... but of course it may be just a fault of my rewrite rule. - Please have a look:
I want to do: http://openspirit.de should be forwarded to the zope folder "noo", located in (zope-root)/openspirit/noo/ of my Zope server.
I can use regular URL-forwarding, URL-hiding and rewrite-rules to achieve this. - It should be possible in some way ;)
Because it didn't work that easy as i expected it tried to do it in small steps, just copied my old and working virtual host entry:
# current rule, works, forward von DynDNS -> IP <VirtualHost openspirit.homelinux.net> ServerName openspirit.homelinux.net ServerAlias openspirit.homelinux.net RewriteEngine on RewriteLogLevel 1 RewriteRule ^/(.*)$ http://coforum.org:9080/VirtualHostBase/http/openspirit.homelinux.net:80/ope... [P] </VirtualHost>
# new domain: http://openspirit.de, does not work; forwarding bzw. URL-hiding from a real hosting <VirtualHost openspirit.de> ServerName openspirit.de ServerAlias openspirit.de RewriteEngine on RewriteLogLevel 1 RewriteRule ^/(.*)$ http://coforum.org:9080/VirtualHostBase/http/openspirit.de:80/openspirit/Vir... [P] </VirtualHost>
In both domain config menues i entered just the IP, so both adresses are analogues to each other:
Maybe you alreday have an idea, how to do the complete thing - i would be so fair to use your solution unchanged ;-)
Do i need URL-hiding in that case? IMO it's all possible with the ruels and i make the domain forwarded just to the IP. I guess URL-hiding is only for sites on free hosting serveices like geocities and so on, right?
Have a nice day,
Florian
P.S. What's the difference between <VirtualHost openspirit.de> und ServerName openspirit.de Why is it there twice?
participants (4)
-
Aleksandar Radulovic -
Dieter Maurer -
Florian Konnertz -
Kevin Carlson