using 301 redirect to create more search-engine friendly URL, utilizing Virtual Hosts

Discussion in 'Apache' started by manouche, Jul 11, 2008.

  1. #1
    I have created a Virtual Host and modified httpd.conf. For this example, I am using mydomain.com as the main domain and virtualdomain.org as the name of the virtual host. The virtual host works just fine if I go directly to it, but the rewrite does not. I am trying to make the URL resolve to the actual name virtualdomain.org so that Google and other search engines will pick it up.

    If I go to:

    http://mydomain.com/home/libdev/docs/

    it results in http://mydomain.com/home/libedev/docs/


    Here is the entry in httpd.conf

    <VirtualHost *:80>
    ServerAdmin root@mydomain.com
    DocumentRoot /www/home/libdev/docs
    ServerName virtualdomain.org
    ServerAlias www.virtualdomain.org
    DocumentRoot /www/home/libdev/docs
    ScriptAlias /cgi-bin/ /www/home/libdev/docs/cgi-bin
    <Location /cgi-bin>
    Options +ExecCGI
    </Location>
    ErrorLog /www/home/libdev/docs/logs/error_log
    TransferLog /www/home/libdev/docs/logs/access_log

    redirect 301 /home/libdev/docs/ http://virtualdomain.org/
    </VirtualHost>
     
    manouche, Jul 11, 2008 IP