Rackspace Cloud Essentials: Tips and Tricks for .htaccess and web.config
Note: This article is written for our Cloud Sites Control Panel. You can get to it from the Cloud Control Panel by clicking your name in the upper-right corner and selecting Cloud Sites Control Panel.
In this article we're going to take a look at the .htaccess file and the web.config file. We'll discuss what they are, and how they're used with Cloud Sites.
If you are using Windowa IIS, ASP/.NET then please click the web.config link to skip to the next portion of this article.
If you are using Linux as your primary technology, then please continue reading below.
Why can't I see my .htaccess file?
Click here to see how to see your .htaccess file.
What is .htaccess and what is it used for?
Wikipedia explains the .htaccess file as follows:
"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
- Password protecting a web site.
- Deny certain IP addresses access to web site
- Prevent hotlinking to resources
- Change the post max size value for php
- Change default php character set
- Change php maximum execution time
- Show php errors instead of blank page
- Change php maximum upload file size
- Change php memory limit value
- Change the post max size value
- Enable directory listing in php
- Stop php scripts from executing in a directory
- Set up error pages for a PHP site
- Install PEAR modules
- Set the default Time Zone
- 301 redirects
- Enable CGI scriptng in root folder
- Change default HTML character set
- Enable Server Side Includes
- Get mod_rewrite working
What is web.config and what is it used for?
Wikipedia explains the web.config file as follows:
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:
- How do I enable Directory Listing in ASP/.NET
- How do I add impersonation to my ASP/.NET Cloud Site
- How do I change the default documentation on my Windows/IIS site
- How do I enable detailed errors in Classic ASP and server side errors in Cloud Sites
- How do I setup customErrors in ASP/.NET on Cloud Sites
- How to rebuild an ASP/.NET application in Cloud Sites
- How do I bin deploy an ASP/.NET application on Cloud Sites
- WCF and IIS bindings
- Why are my HttpHandlers not working for my ASP/.NET site on Cloud Sites
- How do I rectify an invalid view state error with an ASP/.NET application
- ASP/.NET Integrated Mode
- How do I set custom 404's for ASP/.NET
- Overview of Cloud Sites modified Medium Trust
Carry on the conversation in the Rackspace Community.
© 2015 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