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 validates_multiparameter_assignments plugin usage:
0 vijayalakshmi 27 Wed Jul 28, 2010 4:24 am
vijayalakshmi View latest post
No new posts paperclip plugin usage in rails:
0 vijayalakshmi 23 Wed Jul 28, 2010 4:07 am
vijayalakshmi View latest post
No new posts Polymorphism
1 phani.galla 46 Tue Jul 27, 2010 3:27 pm
umamahesh_nyros View latest post
No new posts Deploying Ruby on Rails Application with Passenger
2 sivakrishna.m 630 Tue Jul 27, 2010 2:16 pm
criether View latest post
No new posts Steps to implement star-rating using acts_as_rateable plugin
0 vijayalakshmi 46 Mon Jul 26, 2010 5:47 am
vijayalakshmi View latest post
No new posts Twitter Retweet Integartion
0 Anu 41 Thu Jul 22, 2010 12:27 pm
Anu View latest post
No new posts Usage of build method in rails
0 ktulasi 30 Thu Jul 22, 2010 12:19 pm
ktulasi View latest post
No new posts Facebook Like Integration in Rails
0 Anu 53 Thu Jul 22, 2010 12:16 pm
Anu View latest post
No new posts Fshare in your Rails Application.
0 Anu 39 Thu Jul 22, 2010 12:10 pm
Anu View latest post
No new posts Installation of Postgresql in windows.
1 swaminadhan 198 Thu Jul 15, 2010 10:17 am
proximity3 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