We see that you are viewing the US version of our website from another country. If you would like to view a local version of our website, please click the link below...

Sales: 1-800-961-2888
Support: 1-800-961-4454
Login
  • MyRackspace Portal
  • Cloud Control Panel
  • Rackspace Webmail Login
Share this on:

Rackspace Cloud Sites First 48, 6-2 - Tips and Tricks for .htaccess and web.config

Article Id: 909 | Cloud Sites | Article


In this article we're going to take a look at the .htaccess file and the web.config file. We will discuss what they are, what they are used for and look at some tips and tricks for using both of them on Cloud Sites. If you are using Linux as your primary technology the please continue reading below otherwise, if you are using IIS, ASP/.NET then feel free to click on web.config to skip to that portion of the article. 

What is .htaccess and what is it used for?

Wikipedia explains the .htaccess file as follow:

In several web servers (most commonly Apache), .htaccess (hypertext access) is the default name of a directory-level configuration file that allows for decentralized management of web server configuration. The .htaccess file is placed inside the web tree, and is able to override a subset of the server's global configuration; the extent of this subset is defined by the web server administrator. The original purpose of .htaccess was to allow per-directory access control (e.g. requiring a password to access the content), hence the name. Nowadays .htaccess can override many other configuration settings, mostly related to content control.

For more information and several examples, the following links are highly recommended:

For a more comprehensive technical overview, please see the Apache documentation on .htaccess files.

On the Rackspace Cloud Sites platform, .htaccess can be used for handling certain points of website security, PHP configuration changes as well as website operations. Let's review some of the features. 

.htaccess and website security

Security

  1. Password protecting a web site.
  2. Deny certain IP addresses access to web site
  3. Prevent hotlinking to resources

PHP

  1. Change the post max size value for php
  2. Change default php character set
  3. Change php maximum execution time
  4. Show php errors instead of blank page
  5. Change php maximum upload file size
  6. Change php memory limit value
  7. Change the post max size value
  8. Enable directory listing in php
  9. Stop php scripts from executing in a directory
  10. Set up error pages for a PHP site
  11. Install PEAR modules

Operation

  1. 301 redirects
  2. Enable CGI scriptng in root folder
  3. Change default HTML character set
  4. Enable Server Side Includes
  5. Get mod_rewrite working

What is web.config and what is it used for?

Wikipedia explains the web.config file as follow:

Web.config is the main settings and configuration file for an ASP.NET web application. The file is an XML document that defines configuration information regarding the web application. The web.config file contains information that control module loading, security configuration, session state configuration, and application language and compilation settings. Web.config files can also contain application specific items such as database connection strings.

For more information and several examples, the following links are highly recommended:

Below are some of the most commonly used functions for the web.config file:

  1. How do I enable Directory Listing in ASP/.NET
  2. How do I add impersonation to my ASP/.NET Cloud Site
  3. How do I change the default documentation on my Windows/IIS site
  4. How do I enable detailed errors in Classic ASP and server side errors in Cloud Sites
  5. How do I setup customErrors in ASP/.NET on Cloud Sites
  6. How to rebuild an ASP/.NET application in Cloud Sites
  7. How do I bin deploy an ASP/.NET application on Cloud Sites
  8. WCF and IIS bindings
  9. Why are my HttpHandlers not working for my ASP/.NET site on Cloud Sites
  10. How do I rectify an invalid view state error with an ASP/.NET application
  11. How can I redirect from ASP/.NET to PHP on Cloud Sites
  12. ASP/.NET Integrated Mode
  13. How do I set custom 404's for ASP/.NET
  14. Overview of Cloud Sites modified Medium Trust
© 2011-2012 Rackspace US, Inc.

Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License


See license specifics and DISCLAIMER

Add new comment

©2012 Rackspace, US Inc. About Rackspace | Fanatical Support® | Hosting Solutions | Investors | Careers | Privacy Statement | Website Terms | Sitemap