Showing posts with label Programming. Show all posts
Showing posts with label Programming. Show all posts

Friday, February 06, 2009

How to do redirect page

How to do redirect page?

PHP
<?php
header("Location: http:/harithdawi.com/");
exit();
?>

ASP
<%@ Language=VBScript %>
<%
Response.Status="301 Moved Permanently"
Response.AddHeader "Location","http://harithdawi.com/"
%>

ASP.NET
<script runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location","http://harithdawi.com/");
}
</script>

JAVA (JSP)

<%
response.setStatus(301);
response.setHeader( "Location", "
http://harithdawi.com/" );
response.setHeader( "Connection", "close" );
%>

.HTACCESS (redirect all from old domain to  new domain)

Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://harithdawi.com/$1 [R=301,L]

JAVA SCRIPT
<script type="text/javascript">
<!--
window.location = "http://harithdawi.com/"
//-->
</script>

Sunday, January 25, 2009

URL Password Protection

URL Password Protection

Instructions on how to set this up manually on the server for other directories.

1) Place the following in a text file called '.htaccess' under the directory you wish to password protect, replacing "USERNAME" with your username and "HTACCESS_USERNAME" with the username you wish to grant access to:

AuthUserFile /home/USERNAME/.htpasswd
AuthGroupFile /dev/null
AuthName ByPassword
AuthType Basic

require user HTACCESS_USERNAME

2) Login to your domain via ssh and run the following command. This will create a .htpasswd file and an htaccess user.

htpasswd -c /home/USERNAME/.htpasswd HTACCESS_USERNAME

Enabling Directory File Listing

Enabling Directory File Listing

Put the following in .htaccess in the directory you want the index enabled for:

Options ExecCGI Indexes Includes FollowSymLinks

NOTICE the filename is .htaccess, that is (dot)htaccess.