Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

htaccess


FIMBLE

Recommended Posts

Posted

Password protect your Admin: - Simple method.

You may find an easier way to do this in contributions, search for htaccess.

 

Why would you want to?

Simple really, if you loose, forget, or suspect that your existing passwords/username is known you can also use this help to create another one simply by editing the passwd file!

 

You can see the result at http://www.linuxuk.co.uk/test the username and password are linux

 

Many control panels now have a tool for password protecting directories; it is worth checking first to see if you have one. If not.........

 

Things you need before you start.

BACK UP!

Access to your website control panel, file manager especially

 

Your home path to the root server (you can get this from the catalog>includes>configure.php) home/username/public_html Notepad or better.

 

FTP client (not really required though)

 

The .htaccess file can be used for many things so before you go ahead and overwrite yours check it first, you may have to add this on to what is already there, Admin .htaccess generally does not have anything in it, but please check first!

You can read your file through your control panel file manager, notepad, your ftp client etc..

 

Method;

Go to my site http://www.linuxuk.co.uk/cgi-bin/htpass.cgi

Enter a username and password, then click on get password, the screen returns your encrypted password for you, I put in linux and linux it returned this

linux:6oEJFxXFeoMcU

Highlight and copy the line that you made.

 

Log into your cpanel & go to your file manager, in the root directory (the first one you see)

You will see a folder called .htpasswds

 

Open the folder, and create a new one called Store (or whatever you like). Open the folder and click Create new folder again, name this Admin (or what ever you like), Open the new folder and click on create new file, name it passwd.

Click to open the passwd file and paste the user name and encrypted password you copied earlier, save the file and exit.

You have now set your password and user name, now we need to set up the .htaccess file so it knows the folder it is in is protected and where to look for the password and user name.

 

You can use your FTP client or the file manager for this stage.

Go to Your catalog / Admin / you will see the .htaccess file there (usually first after the folders) open it and you may see the text below or it may be blank............

 

________________________________________________________________________________

______________

 

 

# $Id: .htaccess,v 1.1 2003/06/20 00:18:30 hpdl Exp $

#

# This is used with Apache WebServers

#

# For this to work, you must include the parameter 'Options' to

# the AllowOverride configuration

#

# Example:

#

# <Directory "/usr/local/apache/htdocs">

# AllowOverride Options

# </Directory>

#

# 'All' with also work. (This configuration is in the

# apache/conf/httpd.conf file)

 

# The following makes adjustments to the SSL protocol for Internet

# Explorer browsers

 

<IfModule mod_setenvif.c>

<IfDefine SSL>

SetEnvIf User-Agent ".*MSIE.*" \

nokeepalive ssl-unclean-shutdown \

downgrade-1.0 force-response-1.0

</IfDefine>

</IfModule>

 

# Fix certain PHP values

 

#<IfModule mod_php4.c>

# php_value session.use_trans_sid 0

# php_value register_globals 1

#</IfModule>

 

_________________________________________________________________

 

After the last line add if there is already text there, if not add it at the begining.

 

__________________________________________________________________

 

AuthType Basic

 

AuthName "staff only"

 

AuthUserFile "/home/xxxx/.htpasswds/store/admin/passwd"

 

 

require valid-user

 

__________________________________________________________________

Variables you can change

AuthName "change to what you want"

AuthUserFile "/home/your website user name/then the path to the password file, if you have used the names in this example then you can leave the rest as is, otherwise you need to add the names you called your folders.

 

Save the file.

That’s it!

 

Now log out of your internet browser, and log into your Admin, it will ask you for your pass word and user name :-)

 

Please note: if you are going to do this using notepad, or another text editor when saving .htaccess save it with " " before and after ".htaccess" otherwise it will be saved as .htaccess.txt

Sometimes you're the dog and sometimes the lamp post

[/url]

My Contributions

Posted

Hello,

Thanks for your help.

In my case I want to change the username and password of my admin pages but I dont have this files htaccess and passwd.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...