Hostgator VPS generates apache's httpd.conf file automatically. Therefore, any new lines you add to apache's configuration file will be overwritten. In order to add new configuration settings we need to include a configuration. Open up your main config file /etc/httpd/conf/httpd.conf and search for a virtual host with the domain name you wish to edit. Last two lines of your virtual host should look similar to this:

# To customize this VirtualHost use an include file at the following location
#    Include "/usr/local/apache/conf/userdata/std/2/linuxcon/linuxconfig.org/*.conf"

uncomment the Include line by remove leading "#".

Next, create a directory to reflect the Include location:

# mkdir -p /usr/local/apache/conf/userdata/std/2/linuxcon/linuxconfig.org/

Once your directory is created add a new .conf file. For example:

# cd /usr/local/apache/conf/userdata/std/2/linuxcon/linuxconfig.org/ 
# echo "redirect 301 /some-url http://linuxconfig.org" > redirects.conf

Next check your apache configuration file:

# apachectl -t
Syntax OK

Once you confirm correctness of your syntax restart apache webserver:

# service httpd restart

Test your new redirect and if all goes well make sure that you do not have duplicate redirects in your main .httaccess file.

Free Linux eBooks

Do you have the right skills?

Our IT Skills Watch page reflects an up to date IT skills demand leaning towards the Linux and Unix environment. We have considered a number of skills and operating systems.

See the result...

Linux Online Training

Learn to run Linux servers and prepare for LPI certification with Linux Academy. 104 available video lessons with PDF course notes with your own server!

Go to top