How to htaccess: Password Protecting Your Pages
You're building a new site, but you only want yourself (and maybe a select few) to be able to view the work-in-progress.
You have an area of your site that you never want the general public to have access to - for example, your web stats or private pages.
You have some paid (subscription) content on your site that only subscribers should be able to access.
Apache lets you password protect individual files, folders, or your entire site fairly easily. Read on to find out how it's done.
What to do:
To add password protection to your pages, you need to do the following two things:
- Create a text file on your server that will store your username and password.
- Create a special file called
.htaccessin the folder you want to protect.
That's it! Now let's take a look at how to do each step.
How to do:
- Creating the Password file:
The first step is to create a simple text file that will store your username and password, separated by a colon (:). The small catch is that the password must be encrypted. Luckily, there are many free web-based utilities that will encrypt the password for you. Try one of these:
- 4WebHelp's online .htpasswd encryption tool
- Alterlinks .htaccess password generator
- htmlite's htpasswd encryption page
Simply enter your desired username and password in one of these pages and submit the form. You'll get back a string similar to the following:
Now, open up your favourite text editor (e.g. Notepad or TextEdit), then copy and paste the username/password string into the editor. Save the file and call itbt:3kgHAH7CKtZAw
.htpasswd. Next, upload this file to your website. Make sure you place it outside the Web root of your site if possible, as you don't want just anyone to be able to view the file! For example, place it above your public_html or htdocs folder. (Having said this, Apache is often set up by default to block web-based access to files beginning with .ht. Better safe than sorry though!)
If you can't place your .htpasswd file outside your Web root, name it something that's not easily guessable - for example, .htxuymwp - so that people won't be able to find it easily. (In addition, it helps to start the filename with .ht; as mentioned earlier, Apache usually blocks access to files starting with .ht.)
Alternative: Creating the password file using htpasswd
If you have SSH access to your web server (or you're running Apache on a local machine), you can encrypt your password and add it to your password file in one go by using the htpasswd utility that comes with Apache. Simply SSH to your server or open up a terminal window on your local machine, cd to the folder where you want to create your password file, and type:
htpasswd -c .htpasswd fred
(where fred is the username you want to use). You'll be prompted to enter and retype your password, then the .htpasswd file will be created for you.
- Creating the .htaccess file :
.htaccess file will do. Open your text editor again, create a new file, and save it as .htaccess.
Protecting a folder: To password protect a folder on your site, you need to put the following code in your .htaccess file:
AuthUserFile /full/path/to/.htpasswd
AuthType Basic
AuthName "My Secret Folder"
Require valid-user
/full/path/to/.htpasswd should be the full path to the .htpasswd file that you uploaded earlier. The full path is the path to the file from the Web server's volume root - for example, /home/username/.htpasswd or C:\wwwroot\username\.htpasswd. (If you're not sure of the full path to your site or home directory, ask your Web hosting company for this info.)
The above .htaccess file will password protect all files in the folder that it is placed in, and all sub-folders under that folder too. So if you wanted to password protect your entire site, you would place the .htaccess file in your Web root folder.
Protecting a file: To password protect just a single file in a folder, use the following .htaccess file:
This will password protect just the mypage.html file in the folder where you put the .htaccess file.AuthUserFile /full/path/to/.htpasswd
AuthType Basic
AuthName "Restricted Access"Require valid-user
- Uploading the .htaccess file
Utilization:
Now use your Web browser to visit the folder or file that you've protected. You should see a password dialog like the one shown at the start of this tutorial. Type in the username and (unencrypted) password that you chose earlier, and you should be given access to your folder or file!
Note: with this type of password protection, you continue to have access to the password protected stuff until you restart your browser.
You have got issues?If you can't access your stuff and the dialog keeps popping up, check that you entered the username and password correctly. If it still doesn't work, check the path to your .htpasswd file on the server - make sure the path specified in the AuthUserFile directive is correct. Also make sure that both the .htpasswd and .htaccess files are readable by the Web server user (chmod 644 should do the trick for UNIX/Linux/FreeBSD servers).
If the password protection isn't working (i.e. you can still access your stuff without needing to enter a username/password), check that you uploaded your .htaccess file to the right folder. Also check that your web server supports .htaccess password protection (it needs to be an Apache server, and your server admin needs to have enabled the AuthConfig override for your site).
Password protecting more stuff
- If you want to password protect other folders (that aren't under the currently protected folder), simply copy your .htaccess file to the new folder to be protected.
- To password protect more than one file in the same folder, just create more blocks within the same .htaccess file - for example:
AuthUserFile /full/path/to/.htpasswd
AuthType Basic
AuthName "My Secret Page"
<Files "mypage.html">
Require valid-user
</Files>
<Files "myotherpage.html">
Require valid-user
</Files>
Adding more usernames and passwords
You're not restricted to just one username/password. If you want to add other usernames and passwords, simply repeat the "Creating the password file" procedure above, but add each new username/password line to your existing .htpasswd file, e.g.:
arif:p29cmnwl4a0et
stranger:vwp45xakfh89
Alternatively, if you're using htpasswd to create your passwords, as described earlier, then you can add extra users with the command:
htpasswd .htpasswd stranger
(where stranger is the username you want to add). Make sure you don't include the -c option when adding additional users, or htpasswd will attempt to create a new password file!
Reference:
Trimming with Javascript
The custom trim function :
function trim (str) {Typical use of trim :
var str = str.replace(/^\s\s*/, ''),
ws = /\s/,
i = str.length;
while (ws.test(str.charAt(--i)));
return str.slice(0, i + 1);
}
function validate()Surely if you use any rich javascript library a trim method should come with it. Have fun :)
{
val = document.getElementById("txt").value;
retval = trim12(val);
alert(retval);
}
Clouds in the net
You can have a look at them. Happy clouding :
Skydrive: 25GB[started with 5GB !!] of free file storage and sharing cloud service brought by microsoft live.
Live Mesh: Brought by microsoft live for synching files and folders from your your devices and making them available over one another plus over an webdesktop.
eyeOS: Opensource Cloud desktop. The first cloud that I got amazed of the one that inspired me in next generation web application development.
Google Docs:Document sharing cloud on the net that use to store and share and collaboration on creating a document.
gOS: Connecting all the open services online on a thin client over a light weight linux OS. I guess the same approach is being adopted by Google OS.
CloudDB: As the name says it is a cloud for databases. And the service is free - at least to some extent
[To be continuted...]
Some Popular Youtube Clone - Video Portal Scripts
PHPmotion -
This is a free, opensource script and a good startig point if you do not have the money, but would like to experiment to see what kind of traffic your video niche portal can attract. I would not recommend it to anyone who is serious. It works well, but the design templates and the functionality is not that great. But, if you are on a shoestring budget and all you want to do is throw up something quickly and cheap - you can try this. Score: 7/10
Clip-Share - One of the initial players in this space. Has amazing graphical and layout templates that can be purchased in addition to the 4 basic templates that come pre-packaged. This is a solid script and a highly recommended choice for the serious. They sell 2 different versions - a Lite version at $99 and a Pro version at $199. You can purchase additional Web2.0 look-and-feel design template for $100 each. The template files can easily be customized as you wish. I had no problem whatsoever with their support and they were prompt to answer and get back to me with solutions to the problems I faced. If you have the budget go for this one. Recently GodTube.com that uses their script gota funding round of $30 million. Score: 9/10
Rayyz.net - This script is not just for video sharing. It is a complete Social Media website that has has video, photo, music, files, articles, games, blogs and community networking built into the dash board. If you’re looking for a more than just video and a full fledged script of Social Networking around various media - then take a look at this script. Athough, I have not personally tested this script or worked with it - it seems to be alright. the price is a bit steep at $418. If you are serious about setting up a Social Netowrking site around media sharing content, it would be better if you installed Boonex (which has a free version). However, dont strike out Rayzz from your list - as it is quite powerful in its own way (it focuses more on the Social Media sharing tools and aspect than the Social Networking aspect, which is what Boonex does). Score 6.5/10
Attachmax - This script will allow users to download the videos in addition to viewing them streamed. The script comes with a basic database of videos so you can have pre-populated content on your site. While the layout and graphic design may suit some people, I thought the script was pretty average and not too focused. At $$ , this may be a good buy to some of you. Score: 6/10
Alstrasoft Video Share Enterprise - Stay far far away from this one. Its got holes in it and the people behind it have a very bad reputation. I don’t want to bash them too much, but just do a search on Google with their name and you will see what other disgruntled people are saying on various forums. At $300 this is a complete waste of money (even though I would not pay even $10 for it). You have been warned! Score: 0/10
MediaMax Script - This script is a recent re-branding of Video Watch Pro. They have videos, pitcure, audio and social networking too - built into this script. The site and demo looks pretty impressive at $299 and they even have a Google Adsense flash video integration - which will allow you to earn more money within the flahs player. I have read elsewhere that their customer service is not up to mark - but this is not from a confirmed source. I think - you are good to go if you like their look and feel and functionality. Quite impressive. Score: 8/10
VShare - This is the script with the highest value-for-money at $10 !! The features are very advanced and their are plenty of them. I was quite taken by surprise to see the amount of features this script had packed into it - such as, alternate video server uploading, youtube direct embedding etc. The only drawback was the graphical template… it looked a bit ordinary. So, if you have the time and resources to alter template files - then i recommend this script highly. Although there are a few vendors on their site forums who are selling laternate templates, I am yet to see one which is “professional looking”. Also, I’d like to point out that their support and forums are extremely good and I got answers very quickly. Install this script if you have the ability to dabble around with the template and improve its basic look. Score: 9/10
osTube - This script is a media sharing model and offers Video, Photo, Audio, Documents, Community and Blogs. The pre-packaged templates look quite impressive and the functionality and video player look good. I don’t have any idea what it costs - but you should test drive their free version, which has limited features, before you buy their paid versions. They are definitely the most impressive “media sharing” scripts out their from what I can see. May not have as many functions as Rayzz (above), but definitely a better and sleeker dashboard - although I dont know how the engine is under the hood. On what i’ve seen and assuming this script works well, I give them - Score: 8/10
PHPmelody -
If you’re looking to setup a Music Videos website, then this is script is fantastic. It does not allow you and your visitors to directly upload videos to the site - but one can embed videos from Youtube - which is a fantastic feature, as not only does it save bandwidth and server resources but it also allows you to quickly add content. They also have a neat “keyword” based search that the admin can use to find videos on Youtube and add them with one click! The script comes pre-packaged with thousands of pre-populated music videos - if you want to get content included right away. A breeze to install, and definitely worth the price at $39 with additional layout templates at $10 to $19. Support is excellent and prompt. Score: 10/10 if you are creating a Music Video website.
VidiScript - This one is a free script and it looked pretty decent (front end) - with ability to show pre-roll ads, insert text banner ads inside video player, a decent flash player, and two not-so-good light and dark templates (that can always be improved by you). VidiScript not only supports Videos, but now also supports Audio, Photo and Flash Game uploads. I dont know how stable this script is and how it will hold up for a busy site, but… hey… its free! and so definitely worth a try. Score: 8/10 (based on what I saw in the front end demo)
Clip-Bucket too. Its free and open sourced. I am not sure how secure it is and how it performs when measured up with the scripts above, as I had a quick look at the front end, but did not install it or use it on a site of my own. I must say for free price, the templates, the player the look and feel are HIGHLY professional and the folks behind it have done a great job in making a very neat user interface and front end. By the looks of it - this is going to be a killer video sharing script … and will probably put behind vhsare and phpmotion - if the backend lives up to the quality of the front end.
Mass video populator: It claims that it will allow you to mass populate and add videos to your video site (all scripts above are supported), in a few clicks. The price, I believe is the only downside as they have gone in for a bulk pricing, which works out to around 10 cents a video - steep I thought, for someone who wants to add say 1000 videos. Its a web based remote service.
VideoWatchPro: It is not that great, and scores around 5/10, from a brief look. I havent seen it in depth - but it doesn’t look to be anything worth spending more time on.
Conclusion: I suggest that you pick and choose from the scripts above and if you are selecting one not listed above you do your homework well - as their are many clones and copies of pre-existing scripts out their with holes in them. Start doing your research on this page of hotscripts.com - that lists a whole bunch of media sharing php scripts, and also make sure you visit forums such as Programming Talk to read reviews posted by other customers.
Open Source Social Networking Software
spree
spree is an expert search engine where users ask questions to find other participating users, who are knowledgeable in that area and willing to help.
iSocial
iSocial is a free social networking CMS software that allows you to create your own Friendster and Orkut like sites. Use bookmarks, dating and create groups with just one mouse click.
Mahara
Mahara is fully featured electronic portfolio, weblog, resume builder, and social networking system for connecting users and creating online communities.
Yogurt
This is a Social Network module for xoops CMS. You have seen Facebook, Orkut, Myspace , try Yogurt for Xoops!VMukti
VMukti is a Unified Social Collaborative conferencing engine. Allows access through personalized, mashable web-interface. Core features:- Video conferencing, Audio conferencing, IP Telephony, Desktop sharing, Chat, Whiteboard, Presentation & More.
The PeopleAggregator
The PeopleAggregator is a next-generation social networking system that goes beyond the idea of social networks as mating games, and attempts to use open standards, network inter-connectivity and massive flexibility.
Appleseed
Appleseed is (augmented) social networking software, ie Friendster, only distributed. Sites running Appleseed will interoperate, and form the 'Appleseed Social Network.' Development is focused on privacy and security, as well as ease of configuration.
Mugshot Project
Mugshot was a social networking website created by Red Hat. Unlike most other social networking websites (which are concerned with advertising), it offered a desktop client and web widgets. Mugshot was meant to facilitate real-world interactions with friends, and make one's normal computer use more social. It provided the functionality of a social network aggregator. GetBoo
Web 2.0 bookmarking system, both social (with tags) and private (with folders). Import and export your bookmarks from Firefox, IE, Mozilla, Netscape. Admin management section, translations, groups, bookmarklets, Firefox extension, RSS feeds, and more!
Akarru
Akarru is a social bookmarking engine, is used to build social bookmarkings sites, like www.blogmemes.com. Users posts links and promote links to front page using voting system.
Scuttle
Web-based social bookmarking system. Allows multiple users to store, share and tag their favourite links online.
SemanticScuttle
SemanticScuttle is a social bookmarking tool (based on Scuttle) experimenting new features as hierarchical tags, collaborative descriptions or OpenID authentification.
AROUNDMe
Create collaborative social websites (like Ning, Myspace, Yahoo or Google groups). Each group can create a multiple web pages. They get a drop in guestbook, blog, forum and wiki. Each group is fully customizable using xHTML, CSS, Javascript and PHP.
Clonesumating
Clonesumating is the open source version of the code that runs CONSUMATING.COM. It features many state of the art social networking functions including user profiles, user tagging, matching and discovery based on quirky tag combinations, group activities such as weekly photo contests and blog questions, an event calendar, RSS feeds for everything, etc. It is written primarily in mod_perl.
BeWelcome Rox
Get to know the global village and other cultures, share your place. BW Rox is the platform driving www.bewelcome.org and other social networks, aiming to bring people together in real life. Organize your travel or stay abroad, travelblog, meetings, ...
ICEcore
ICEcore open team collaboration software uses social networking to unify team workspaces w/ real-time web conferencing. Collaboration for knowledge networking, program management, communities-of-practice, telework, ...
Memephage
Memephage is an automated web log (blog). It passively gathers and summarizes links from various places. Currently: IRC, social MUDs, e-mail, and web browsers. Uses the POE multitasking and networking framework for Perl.
InteractOLE
A platform for the delivery and support of online learning. It differs from many other elearning platforms in that its aim is to concentrate on the social/interactive aspects of teaching and learning rather than the delivery of content to students.
Elgg
Elgg is an open source social networking platform developed for LAMP (Linux, Apache, MySQL, PHP) which encompasses weblogging, file storage, RSS aggregation, personal profiles, FOAF functionality and more.
CommunityNews
CommunityNews uses social bookmarking and bayesian techinques to provide periodic postings to blogs. Users can vote for or against RSS sources ti increase the chances that the source is used again. Spam filtering (bayesian) is provided by spam bayes.OpenPNE
OpenPNE is a Social Networking Service Engine written in PHP. It has many features(friend control,friend invitation,diary,blog feeds,message box,etc).
MonkeyChow
Feed Aggregator Reader (branched from FeedOnFeeds) with Social Bookmarks (del.icio.us, Blogger, Newsvine, Technorati, mailto), Article Starring, Feed Tagging, OPML, Article Search, Reblogging and Refeeding, Aging, and Edit feed attributes.
NewsCloud
NewsCloud is an open source media platform for citizen journalism and the social news network hosted at NewsCloud.com.
Feed Me Links
Feed Me Links stores your bookmarks online so you can get to them anywhere. Import your favorites and share your links with friends. Add tags to organize your links. Discover new things.
WorldSpace
WorldSpace is a user-extensible shared virtual environment, aimed at being a next-generation social networking system.
Social Networking POC
A networking site on the lines of Orkut.Right now we plan to build it on Jboss seam and use a Java content management system like apache Jackrabbit as the backend. It would be more of a POC than an actual commercial app.
Zoints
Zoints is intimately aware that online communities are the most important aspect of the internet. Our free software solutions are designed to help solve the three major problems forum owners face: Member acquisition, Member retention and Profitability.
earth-life-simulation
A simulation of the world, there will be a global map representation and players can choose a country or civilization and develop it's social, political and military existence.
PHPizabi
PHPizabi is one of the most powerful social networking platforms on the planet. With literally thousands of websites powered by PHPizabi including everything from simple friends sites to the most complex networking super sites out there.
Ozcode
Ozcode is the source code behind Ozmozr.com, a microformat-aware RSS aggregator, social networking, resource sharing, identity aggregation and presentation site.
TallStreet
TallStreet.com is a new search engine concept where users make investments, with fictional money, in their favourite websites and the rankings are determined entirely by the users.
Jamss
Jamss is a social news site based off of Digg.com. Jamss allows for peer submission and review of web articles and can be adapted to fit a variety of themes. Jamss runs on PHP/MySQL.
Dolphin
Dolphin is open-source and free, although there is a cost associated with removing the company�s links from your site.
Ospo
Ospo is an opensource social portal project. It use standard function (add, remove friends, top10), forums integration, music module (artists directory with albums, songs), shoutcast integration, blog (add, delete, modify, view) and so on.
AstroSPACES
AstroSPACES is the world's first open source social networking solution. Coded from scratch, it is highly efficient and very easy to use.
FlightFeather
FlightFeather's goal is "social networking for everyone". This means that anyone should have a chance to run a popular social networking site -- on minimal hardware, and without wasting bandwidth.
SNOSS
Social Networking Open Source Software, an open source social networking framework, written in PHP, Javascript and MySQL with an AJAX UI.
OpenSocialNetwork
OpenSocialNetwork is a social network of open source. Its main task is to create a social network releasing the source code.
S3B
S3B - Social Semantic Search and Browsing - is a middleware that delivers a set of search and browsing components that can be used in J2EE web applications to deliver user-oriented features based on semantic descriptions and social networking.
Facelift
Facelift is a visualization and analysis software for online social networking services. It displays a given community as a node-link diagram and provides several search / filtering functions as well as cluster analysis features.
TagLogs
- Technology (15)
- Tips (5)
- php (5)
- Interesting (4)
- JavaScript (4)
- .htaccess (3)
- Dot Net (3)
- Web (3)
- Bangladesh (2)
- Cloud Coumputing (2)
- Information (2)
- Music (2)
- SEO (2)
- Socket (2)
- dojo-0.4.3 (2)
- url rewriting (2)
- Business (1)
- C# (1)
- Computer Vision (1)
- Day Light Saving (1)
- Internet (1)
- Microsoft (1)
- Opensource (1)
- Origami (1)
- SOAP (1)
- Thumbrules (1)
- Video (1)
- Web2.0 (1)
- Webservice (1)
- dojo-0.4.3-Tree (1)
BlogRead
-
-
The Realm of Electronic Commerce3 days ago
-
-
Rewrite v/s Refactor Dilemma5 days ago
-
-
-
Casual empiricism: the size of tea cups3 years ago
