mmcds Posted July 3, 2007 Share Posted July 3, 2007 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. Quote Link to comment Share on other sites More sharing options...
steviewdr Posted July 3, 2007 Share Posted July 3, 2007 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.