Senior & Expert RoR Developers Discussion Forum by Nyros Technologies

HIRE Ruby on Rails Expert Developers Programmers Coders From India
Ruby on Rails PHP .Net Developers Community, Nyros Technologies, Kakinada
 
Log in  or IF not a member please REGISTER
Username:
Password:   


Keyword
Log in | Profile 

About .htaccess

 
Post new topic   Reply to topic    Senior & Expert RoR Developers Discussion Forum by Nyros Technologies Index -> In & Arround Ruby on Rails
View previous topic :: View next topic  
Author Message
mbchowdari



Joined: 08 May 2008
Posts: 52

PostPosted: Thu Aug 13, 2009 7:30 am    Post subject: About .htaccess Reply with quote

An .htaccess is a simple ASCII file, such as you would create through a text editor like Notepad or SimpleText.

.htaccess is the file extension. It is not file.htaccess or somepage.htaccess, it is simply named .htaccess.

.htaccess files must be uploaded as ASCII mode only. You may need to CHMODthe htaccess file to 644 or (rw-r--r--). This makes the file usable by the server, but prevents it from being read by a browser. (For example, if you have password protected directories, if a browser can read the htaccess file, then they can get the location of the authentication file and then the list to get full access to any portion that you previously had protected.


.htaccess files use the default filename “.htaccess” but any UNIX-style file name can be specified from the main server config using the Access Filename directive. The file isn’t .htaccess.txt, its literally just named .htaccess.

1) Error Documents:

In order to specify your own customized error documents, you simply need to add the following command, on one line, within your htaccess file:
ErrorDocument code /directory/filename.ext
or
ErrorDocument 404 /errors/notfound.html
This would cause any error code resulting in 404 to be forward to yoursite.com/errors/notfound.html

ErrorDocument 500 /errors/internalerror.html

the htaccess file would look like the following (note: each command is on its own line):

ErrorDocument 400 /errors/badrequest.html
ErrorDocument 401 /errors/authreqd.html
ErrorDocument 403 /errors/forbid.html
ErrorDocument 404 /errors/notfound.html
ErrorDocument 500 /errors/serverr.html


2) Password Protection:

Password Protection to your sites to prevent some users to access our site. So you have to to provide password protection for your sites. So create a file called “.htpasswd” with your login details like user name and password to protect.

In the htpasswd file, you place the username and password (which is encrypted) for those whom you want to have access.
For example,

wsabstract:y4E7Ep8e7EYV

Here wsabstract is the username and y4E7Ep8e7EYV is the password

Notice that it is UserName first, followed by the Password. There is a handy-dandy-tool available for you to easily encrypt the password into the proper encoding for use in the httpasswd file.

Create a new htaccess file and place the following code in it:
AuthUserFile /usr/local/you/safedir/.htpasswd
AuthGroupFile /dev/null
AuthName EnterPassword
AuthType Basic

require user wsabstract

The first line is the full server path to your htpasswd file.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Senior & Expert RoR Developers Discussion Forum by Nyros Technologies Index -> In & Arround Ruby on Rails
Page 1 of 1

 latest topics 
 Topics   Replies   Author   Views   Last Post 
No new posts How to customize Google Maps InfoWindow using ym4r_gm
0 kalyanallampalli 49 Thu Sep 02, 2010 5:34 pm
kalyanallampalli View latest post
No new posts Drag and Drop file upload
0 umamageshwari 45 Wed Sep 01, 2010 9:36 am
umamageshwari View latest post
No new posts Flex On Rails
0 Raghu 45 Wed Sep 01, 2010 3:00 am
Raghu View latest post
No new posts MongoDB
0 Raghu 44 Tue Aug 31, 2010 3:30 pm
Raghu View latest post
No new posts Problem with Dreamweaver / java error
3 Raja 36 Tue Aug 31, 2010 3:24 pm
Raghu View latest post
No new posts Generating Model
0 phani.galla 43 Tue Aug 31, 2010 2:09 pm
phani.galla View latest post
No new posts Hide Panels using JQuery
0 Anu 46 Tue Aug 31, 2010 1:50 pm
Anu View latest post
No new posts Load a text file using ajax in jquery
0 Anu 35 Tue Aug 31, 2010 1:39 pm
Anu View latest post
No new posts Generating Migrations
0 phani.galla 29 Tue Aug 31, 2010 1:38 pm
phani.galla View latest post
No new posts Generating Controllers
0 phani.galla 31 Tue Aug 31, 2010 1:22 pm
phani.galla View latest post




Hire an expert Ruby on Rails developer / coder / programmer or development team from India now!!

Other Forums : PHP   ::   .Net   |   Free unlimited HTML CSS templates download

Nyros Technologies   |   Kakinada City Portal   |   Developers Blog   |   About Ruby on Rails Experts   |   More