You are here: ApiroTech > Internet > HTTP

 
 
 

HTTP

PREVIOUS     NEXT

Password protect a web directory with .htaccess

 Apache references the .htaccess file in web document directories for access control information and other uses. A simple configuration allows password protection with multiple username/password combinations.In the directory to be protected, create a .htaccess file with contents like this: AuthType Basic AuthUserFile /safe/dir/htpasswd AuthName "Text displayed in popup" require valid-user There are many other options for .htaccess, but these are basic password related options to get started. The AuthUserFile refers to a fully qualified file that should not be in the web server document directories. The htpasswd file can be named anything, there can be multiple files storing passwords for .htaccess, and each can be shared for use in multiple directories. To create the first and second user/password pairs, use: htpasswd -cb /safe/dir/htpasswd user1 password1 htpasswd -b /safe/dir/htpasswd user2 PaSsWoRd2 Additional user/password pairs can be added using the second form. Be certa... Read More

Rewrite domain.com to www.domain.com using htaccess in Apache

 You may want all visitors to your site using www in front of your domain name (www.yourdomain.com) instead of just your domain name (yourdomain.com). By implementing a simple .htaccess RewriteRule, visitors to yourdomain.com will see the URL change in their browser as they are redirected to the correct URL.To redirect a URL such as "http://yourdomain.com/images/logo.png" to "http://www.yourdomain.com/images/logo.png" use: Options +FollowSymLinks RewriteEngine on RewriteCond %{HTTP_HOST} ^yourdomain\.com RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=permanent,L] In the RewriteRule code, the R=permanent sets the type of redirection (permanent is 301; the default is temporary or 302). The L makes this the last Rule to use and stops rewrite processing.... Read More

Restart Apache without closing open connections

 After making changes to Apache's configuration file (httpd.conf), it is necessary to restart Apache for the changes to take effect. A normal restart will close active connections which may cause problems for users.To restart Apache gracefully without aborting open connections or to start Apache if it is not running: apachectl graceful If apachectl is not in your PATH and you don't know where it is, refer to the recipe Find a file by name to find the location of apachectl, then run it with the fully qualified path, for example: /usr/local/apache/bin/apachectl graceful... Read More

Test the Apache configuration file httpd.conf

 After making changes to the Apache configuration file, it is a good practice to test the configuration before implementing it.To test the Apache configuration file for errors: apachectl configtest If the configuration file is fine, this command will return Syntax Ok. Otherwise, it will return detailed information about the error discovered. If apachectl is not in your PATH and you don't know where it is, refer to the recipe Find a file by name to find the location of apachectl, then run it with the fully qualified path, for example: /usr/local/apache/bin/apachectl configtest... Read More

HowTo: Reboot the Apache Server Safely

 What do you do when you server freezes? This explains the safest steps for rebooting your apache webserver.We've all been there. You try to access your site and nothing works. You can ping and login through your shell, but apache isn't spitting out any info. Here is how to fix it. Short Version: 1. Login as root 2. Try apachectl graceful 3. If doesn't work, apachectl stop 4. ps -ef | grep http 5. apachectl start Long Version: 1. Login and obtain root 2. Type in apachectl graceful and hit enter. This attempts to reboot apache "gracefully" and is the safest way to reboot the server. 3. Try to access your webserver again. If apache is truely locked, often the graceful restart will not work. Give it a minute or two and refresh the site to see if apache is spitting information again. 4. If graceful doesn't work, then you'll need to be a little rougher. Rebooting this way increases your risk of badness; however, if apache is frozen, you are not accessing much data anyway. 5. Type in apachect... Read More

Friendster : Removing Friendster Logo using CSS

 Removing Friendster Logo in your profile using CSS.Here's the code: (put this on on CSS codebox.) #navigation img{width:0px;} *By giving an img a width of 0px, you essentially hide an object from the browser using only CSS codes... Hope it help... Hehehe ^_^ hope friendster doesnt filter this one too hehehehe enjoy!... Read More

Meta Refresh to Redirect

 Easy way of using the meta refresh tag to redirect usersThis recipe describes the meta refresh technique of redirecting users. By placing this tag in your head section of your html file, the user will be directed to another page after a set number of seconds. <meta http-equiv="refresh" content="10; URL=http://www.tech-recipes.com"> By placing this code in the head of your page, visitors will be directed to tech-recipes after 10 secs. 0 secs will try to transfer the visitors as soon as possible. Just change the url above and bounce your visitors to the correct page.... Read More

HTML Printing: Use a Style Sheet to Force a Page Break

 Designing web pages for printing can be difficult. Here's how to force a printer to insert a page break.Designing web pages that can be easily printed can be very, very difficult. PDFs are perfect, but expensive to do dynamically. Anyway, here is a cheap way to insert a page break into a page. Place the following code in the HEAD of the html: <STYLE TYPE='text/css'> P.pagebreakhere {page-break-before: always} </STYLE> Then place the following code in the BODY of the html where you want the pagebreak: <P CLASS="pagebreakhere">... Read More

 

 

Pages : 1