<VirtualHost>

AleSSaNDRo

Verified User
Joined
Nov 19, 2004
Messages
105
Location
Milano(Italy)
Where i can use <VirtualHost> in .htaccess?
In error log there is:
[Sun Apr 23 22:48:55 2006] [alert] [client 82.56.77.163] /home/mynick/.htaccess: <VirtualHost not allowed here
[Sun Apr 23 22:48:55 2006] [alert] [client 82.56.77.163] /home/mynick/.htaccess: <VirtualHost not allowed here

:( :( :(

I want create for example:
test.mondoweb.net that points to /usr/home/mynick/public_html/good/jobs ;)
 
That's true. Modifying httpd.conf is an admin function. If you don't have admin access you'll have to contact the administrator of your server and ask him to make the modification for you.
 
Can you not use the "Subdomains" function for what you want to do? It does not work exactly the same as what you tried to do, but it is similar and could allow you to do what you need.
 
I must use virtualhost because i want do:

test.mondoweb.net -> mondoweb.net/user?id=test

dir.mondoweb.net -> mondoweb.net/user?id=dir

and i can't do it with subdomains :(

I don't want use redirect... :)
 
test.mondoweb.net -> mondoweb.net/user?id=test
dir.mondoweb.net -> mondoweb.net/user?id=dir

Ah, I see. You are right, you cannot to that with subdomains... :(

Actually, I don't see how you could do that with <VirtualHost> either...!
 
Last edited:
Yes, but what about the user?id=test and user?id=dir parts?

Besides, using dns would only point the 'dir' and 'test' subdomains to the correct ip address, but it would not add them to the <VirtualHost> section.
He could use the domain pointer function, that would add them to the ServerAlias entry in <VirtualHost>, but that still would not solve the user?id= problem.
 
Last edited:
The only possible solution I can think of that may make this work is mod_rewrite.
Ofcourse mod_rewrite has to be installed on the server to make this work (you can check that with phpinfo).
 
Another (simpler, but different) solution would be to use domain pointers and check the url in user.php to find out which subdomain was called by the visitor...
 
Sorry. To me it would serve, exactly, this:

*.mondoweb.net -> /usr/home/mynick/public_html/users

For example:
test.mondoweb.net -> /usr/home/mynick/public_html/users
dir.mondoweb.net -> /usr/home/mynick/public_html/users

After, i manage with the script within "users" ;)
 
Have you tried *.mondoweb.net already?
Because I think that still would not work without also changing httpd.conf. You would need to add *.|DOMAIN| to the ServerAlias entry in the <VirtualHost> section. Without that Apache wouldn't know which directory to serve the webpages from.
 
My hoster has setted:

Code:
<VirtualHost IP:80>

        SSLEngine on
        SSLCertificateFile /etc/httpd/conf/ssl.crt/server.crt
        SSLCertificateKeyFile /etc/httpd/conf/ssl.key/server.key


        ServerName *.mondoweb.net
        ServerAlias *.mondoweb.net
        ServerAdmin [email][email protected][/email]
        DocumentRoot /home/anx/domains/mondoweb.net/public_html/forum
        ScriptAlias /cgi-bin/ /home/anx/domains/mondoweb.net/public_html/forum/cgi-bin/

        UseCanonicalName OFF

        User anx
        Group anx
        CustomLog /var/log/httpd/domains/mondoweb.net.bytes bytes
        CustomLog /var/log/httpd/domains/mondoweb.net.log combined
        ErrorLog /var/log/httpd/domains/mondoweb.net.error.log

        <Directory /home/anx/domains/mondoweb.net/public_html/lnx>
                Options +Includes -Indexes
                php_admin_flag engine ON
                php_admin_flag safe_mode OFF
                php_admin_value sendmail_path '/usr/sbin/sendmail -t -i -f [email][email protected][/email]'
        </Directory>



        #php_admin_value open_basedir /home/anx/:/tmp/:/var/www/:/usr/local/lib/php/:/etc/virtual/

</VirtualHost>
and test.mondoweb.net doens't work
 
Last edited:
You appear to have a DNS problem.

The root servers think that DNS for test.mondoweb.net is managed by ns3.crazynetwork.it and by ns4.crazynetwork.it.

Yet neither of these servers are returning answers for test.mondoweb.net.

Jeff
 
I have resolved all :)
I use that code and i must add every time a new dns A ipserver;)
The only problem is:

when i modify settings of domain(for example, when i add subdomains), virtualhost added will be removed :( because it recreates httpd.conf :(
Therefore every time I must reinsert all the code :(
 
Last edited:
Changes to the domain-specific httpd.conf files should be made through the admin-level control panel.

Jeff
 
Back
Top