Jump to content

redirect urls instead of using httpd.conf file


mmcds

Recommended Posts

I am new to apache server.  I have it running on SuSE linux.  I have a domain that will have many redirect url's.  For example, I will have www.domain.com, www.domain.com/products, www.domain.com/books, www.domain.com/movies, www.domain.com/music, etc.  I know I can setup a bunch of redirect statements in the httpd.conf file and that works fine, but is there any other way to do redirects instead of submitting them in the httpd.conf file in apache server?  I'm afraid of the more I add in there, the more chances of spelling errors of my redirects in the conf file or bad statements in the redirects in the httpd.conf file.  Just seeing if there is another easier way and more reliable way to setup redirects with apache server?  Thanks for any suggestions.

Link to comment
Share on other sites

Redirect statements can be placed in a .htaccess file.

 

If apache is running, and you edit the httpd.conf, and RELOAD (instead of restart) apache, it will test the httpd.conf configuration for you (while leaving apache running). Therefore this provides a check of the configuration file (for spelling as you hinted at) while leaving apache running.

 

If you place redirects in a .htaccess file (you will need AllowOverride All in your httpd.conf to allow .htaccess files to work), then if you have a problem with your syntax etc. the www.domain.com website will show up an Error page, which depending on what your running and how large the website is, may look bad.

 

Ideally you shouldnt be doing too much testing on a production box. I would go with the apache RELOAD option ( /etc/init.d/apache2 reload ) to check the configuration files.

 

Edit: you can also do a "apache configuration check" using:

apachectl -t

 

This will test the configuration files (httpd.conf) without attempting to RELOAD or restart apache2, and in high-in-sight would be the better option to go with. The apachectl -t doesnt appear to check .htaccess files, and will only check the main httpd.conf.

 

-steve

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.