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/

SUBSCRIBE TO NEWSLETTER
Subscribe to Linux Career NEWSLETTER and receive latest Linux news, jobs, career advice and tutorials.


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.

FIND LATEST LINUX JOBS on LinuxCareers.com
Submit your RESUME, create a JOB ALERT or subscribe to RSS feed.
LINUX CAREER NEWSLETTER
Subscribe to NEWSLETTER and receive latest news, jobs, career advice and tutorials.
DO YOU NEED ADDITIONAL HELP?
Get extra help by visiting our LINUX FORUM or simply use comments below.

You may also be interested in:



Comments and Discussions