Redirection with Script

Although webhost4life provides "Set Redirection" function in their hosting control panel but some times you still need to achieve that with script. I’ve posted some comman used scripts here for referrence and you can check and try them out yourself.

301 Redirect

301 redirect is the most efficient and Search Engine Friendly method for webpage redirection. It’s not that hard to implement and it should preserve your search engine rankings for that particular page. If you have to change file names or move pages around, it’s the safest option. The code “301″ is interpreted as “moved permanently”.

Below are a Couple of methods to implement URL Redirection

IIS Redirect

  • In internet services manager, right click on the file or folder you wish to redirect
  • Select the radio titled “a redirection to a URL”.
  • Enter the redirection page
  • Check “The exact url entered above” and the “A permanent redirection for this resource”
  • Click on ‘Apply’

ColdFusion Redirect

<.cfheader statuscode=”301″ statustext=”Moved permanently”>
<.cfheader name=”Location” value=”http://www.new-url.com”>

PHP Redirect

<?
Header( “HTTP/1.1 301 Moved Permanently” ); 
Header( “Location: http://www.new-url.com” ); 
?>

ASP Redirect

<%@ Language=VBScript %>
<%
Response.Status=”301 Moved Permanently”
Response.AddHeader “Location”,”http://www.new-url.com/”
%>

ASP .NET Redirect

<script runat=”server”>
private void Page_Load(object sender, System.EventArgs e)
{
Response.Status = “301 Moved Permanently”;
Response.AddHeader(”Location”,”http://www.new-url.com”);
}
</script>

JSP (Java) Redirect

<%
response.setStatus(301);
response.setHeader( “Location”, “http://www.new-url.com/” );
response.setHeader( “Connection”, “close” );
%>

CGI PERL Redirect

$q = new CGI;
print $q->redirect(”http://www.new-url.com/”);

Ruby on Rails Redirect

def old_action
headers["Status"] = “301 Moved Permanently”
redirect_to “http://www.new-url.com/”
end

Redirect Old domain to New domain (htaccess redirect)

Create a .htaccess file with the below code, it will ensure that all your directories and pages of your old domain will get correctly redirected to your new domain.
The .htaccess file needs to be placed in the root directory of your old website (i.e the same directory where your index file is placed)

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

Please REPLACE www.newdomain.com in the above code with your actual domain name.

In addition to the redirect I would suggest that you contact every backlinking site to modify their backlink to point to your new website.

Note* This .htaccess method of redirection works ONLY on Linux servers having the Apache Mod-Rewrite moduled enabled.

Redirect to www (htaccess redirect)

Create a .htaccess file with the below code, it will ensure that all requests coming in to domain.com will get redirected to www.domain.com 
The .htaccess file needs to be placed in the root directory of your old website (i.e the same directory where your index file is placed)

Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^domain.com [nc]
rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc]

Please REPLACE domain.com and www.newdomain.com with your actual domain name.

Note* This .htaccess method of redirection works ONLY on Linux servers having the Apache Mod-Rewrite moduled enabled.

Sign up hosting account at webhost4life now

Posted in Website Programming at June 30th, 2009. No Comments.

Redirect to another url

Webhost4life provides a easy way for redirecting one url to another one. Let us say domaina.com is your website hosted with webhost4life and you want to redirect it to another site domainb.com, you can do that easily in webhost4life’s hosting control panel. Here are  the instructions on how to do that:

  1. Login your account from the Control Panel Login link on top right corner of webhost4life website
  2. Navigate to Site Admin and then open Set Redirection in the left-hand submenu under IIS Manager
  3. You’ll see your domain there and also a link Go next to your domain,please click the link Go there
  4. And then you’ll get to another page called Manage IIS Path / Redirection. Please note there are two functions on that page. The one in the upper place is for changing domain path and the one in the lower place on that page is for setting redirection
  5. Please check the box "Redirect to URL" there and then input the url you want your url redirected to
  6. There are some options like Normal Redirect,Exact URL and 301 permanent redirection. The "301 permanent redirection" is recommanded. And if you want to redirect to specific page like www.domainb.com/welcome.html then you need to use "Exact URL"
  7. And then click Update button to same the settings

If you are not a customer of webhost4life yet you may check it our with their control panel demo.

If you want to sign up hosting account with webhost4life please use "wh4l" as your referral ID(sponsor ID) when you sign up account or click the following link to visit webhost4life and then sign up account so "wh4l" will be recorded automatically as your referral ID.

Sign up hosting account at webhost4life now

Posted in Uncategorized at June 30th, 2009. No Comments.

How do I use my dedicated IP address at webhost4life?

Dedicated IP address also called static IP address. If you want to use dedicated IP address at webhost4life then you may refer to the instructions below:

1) Please contact support via webhost4life helpdesk to purchase your dedicated IP address.

2) Once their technical support staff setup a dedicated IP for you, you’ll need to follow the next few steps to make it work.

Setting up your Domain DNS Record:

1) If your domain name is pointed to webhost4life’s DNS server, then please go to hosting control panel -> DNS -> Zone Editor to update the following A records with the dedicated IP address that was assigned to you:

yourdomain.com

*.yourdomain.com

www.yourdomain.com

Note: If your domain is not pointed to webhost4life’s domain name servers then you need to do that at your domain registrar end.

2) Wait for 1 hour for dns propagation

Setting up your Website to correspond to the new dedicated IP address

1) Go to your control panel->site admin->change path

2) Find your URL and click on "View IP"

3) Choose the new dedicated IP and select update.

Note: depending on your ISP, it might take few hours before you’ll see the updated IP.
 

Posted in Domain and DNS at June 27th, 2009. No Comments.

Connect MySQL DB with MySQL .NET connector

How to connect MySQL DB with MySQL .NET connector at webhost4life? Here are the instructions you can follow up to do that:

There is no installation required on server,  you only need to upload the Mysql.Data.dll to the site "bin" folder. You can download the MySQL .NET connector at ‘http://dev.mysql.com/downloads/connector/net/6.0.html’. The MySQL.Data.dll locates on the "Installation path\Assemblies". Default path is "C:\Program Files\MySQL\MySQL Connector Net 6.0.3\Assemblies".

********************************************************************
[Sample .aspx]
<%@ Page Language="VB" debug="true" %>
<%@ Import Namespace = "System.Data" %>
<%@ Import Namespace = "MySql.Data.MySqlClient" %>
<script language="VB" runat="server">

Sub Page_Load(sender As Object, e As EventArgs)

    Dim myConnection  As MySqlConnection
    Dim myDataAdapter As MySqlDataAdapter
    Dim myDataSet     As DataSet

    Dim strSQL        As String
    Dim iRecordCount  As Integer

        myConnection = New MySqlConnection("Server=mysqlxxx.mysite4now.com;Database=DBname;Uid=DB_ID;Pwd=DB_pw")

        strSQL = "SELECT * From [table name];"

    myDataAdapter = New MySqlDataAdapter(strSQL, myConnection)
    myDataSet = New Dataset()
        myDataAdapter.Fill(myDataSet, "[table name]")

    MySQLDataGrid.DataSource = myDataSet
    MySQLDataGrid.DataBind()

End Sub

</script>

<html>
<head>
<title>MySQL test</title>
</head>
<body>

<form id="Form1" runat="server">

<asp:DataGrid id="MySQLDataGrid" runat="server" />

</form>

</body>
</html>
********************************************************************

In some application you are required to add the following lines in web.config file.

<system.web>
                <compilation debug="true" urlLinePragmas="true">
                        <assemblies>
                                <add assembly="MySql.Data, Version=6.0.3.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D"/></assemblies></compilation>
                <authentication mode="Windows"/>
                <customErrors mode="Off"/>
        </system.web>
        <system.data>
    <DbProviderFactories>
      <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.0.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/>
    </DbProviderFactories>
</system.data>

Posted in Database at June 27th, 2009. 1 Comment.

Move domain to a different account at webhost4life h

If you have several hosting accounts at webhost4life then you may need to move a website from one hosting account to another one.How to do that? You can refer to the instructions below to do that:

1) Login to hosting control panel

2) Remove the domain from the account (after login Control Panel, click “Domain” >> “Delete Domain“, select “Domain Transfer To Another Account” if there have email service of this domain). Logout.

3) Login another hosting account

4) Add the domain to that  account in Domains >>Domain hosting >> Domain Name

5) Go to “DNS” and edit the DNS of the domain

6) Change the A record of yourdomain.com, *.yourdomain.com & www.yourdomain.com to the new server ip of the new account.

7) Save
Wait about 45 minutes for the DNS propagation.

9) Restart your computer and give the domain a test.

Posted in Domain and DNS at June 25th, 2009. No Comments.

Dedicated IP Address

What’s a dedicated IP address?Do I need a dedicated IP address?Many people are having the same questions.Now I’ll give you a brief introduction of dedicated IP address and the advantages of having a dedicated IP address.

The definition of dedicated IP address is "An IP address dedicated to a single website". When you have a dedicated IP, you can view your website using your domain name or the IP address. If you domain is not yet pointing to your hosting server, this will allow you to view your site online, without using your domain name. This is mainly an advantage of deicated IP address, so they can view their website prior to their domain resolving.

Dedicated IP addresses are mainly needed for SSL. If you want to encrypt the messages sent between your website and server using SSL certificate then you will need to setup a dedicated IP address for your website.

Dedicated IP address is also good for search engines.Search engine optimizers tend to prefer dedicated IPs to avoid the risk of being caught up in an IP ban caused by slash-n-burn shared hosting neighbhors. Regardless of whether this is a real or perceived risk, many webmasters would rather be safe than sorry.

In the hosting market today most of websites are using shared IP address. If you are hosting website with a shared IP address then there may be hundreds of other websites are using the same IP address.Now what happens if any ONE of the hundreds of web sites that are sharing your IP address breaks the rules of one or more search engines? Yes, the search engines may remove or ban that website domain, but guess what…they may also remove every other website using the same IP address. Since it’s easier for search engine spammers to get new domain names than it is to get a new IP, search engines often choose to ban IP addresses for abusive behavior. This means that your site can become banned even if you follow all their rules to the letter. You’re guilty by association!"

 Webhost4life is offering dedicated IP hosting. If you are hosting a website with  them but not hosting a dedicated IP address you can submit a helpdesk ticket to request it. If you are not a customer of webhost4life yet please click the link below to visit their official website for more details of their hosting packages:

Go to webhost4life

Posted in Uncategorized at June 25th, 2009. No Comments.

How to install Virtuemart on Joomla

VirtueMart is a free, Open Source e-commerce application, developed for Joomla CMS (Content Management System). It is coded in PHP format, so it can be fully integrated into any Joomla e-commerce website. Much like Joomla, VirtueMart can be modified and customized with no restrictions.

VirtueMart is a complete shopping cart solution that can also be run as a catalogue. One of the most attractive features of this powerful application is its capacity to handle numerous categories, products, customers and shipping modules. You can even sell downloadable goods such as mp3 files, software and videos.

This tutorial will walk you through the process of installing VirtueMart to set up a shopping cart for your Joomla website. Read o to learn more.

  1. Step 1
  2. You will first need to download the full VirtueMart package, which is available at the official website: www.virtuemart.com. Save the downloaded package to your hard drive.
  3. Step 2

    Next, you will install the core component for VirtueMart. Log in to your Joomla adminitrator’s page. Click on the Installers link and then select Components from the drop-down menu. Click on the Browse button and then select the component file called "com_Virtuemart.x.x.tar.gz"

    Click the button to Upload File and Install. The core VirtueMart element is now installed to your Joomla server.

  4. Step 3

    Next, you will install a VirtueMart module that will give you access to the VirtueMart shopping cart. Click the Installers link. Select Modules from the drop-down menu.

  5. Step 4

    Click on the Browse button and then select the VirtueMart module file from the installation package. The name of this module file is: mod_Virtuemart.x.x.tar.gz. Next, Click the button to Upload File and Install. Your Joomla website now has VirtueMart installed! The Virtuemart component is now ready for use.

  6. Step 5

    Click on the Components link on your administrator’s home page. You will find that the Virtuemart option is now available on the dropdown menu. Click on that link. Next, click on the option to Go directly to Store.



     

This next step may take a few moments, and it is very, very important not to interrupt the process.

Once it is complete, you can begin to use the VirtueMart component to open and run an online store on your Joomla website.

Posted in Uncategorized at June 19th, 2009. 1 Comment.

webhost4life control panel

Webhost4life Control Panel is more user-friendly and much faster than most of other webhosting providers in market. Many webhost providers are using Cpanel or  Plesk while webhost4life developed a control panel site themselves.

Webhost4life’s control panel is so powerful that you can do almost everything related to website hosting with them from purchasing a domain to publishing a completed website in the control panel.

Some of the functions in webhost4life’s control panel are:

  • upload/download website files
  • backup/restore DB
  • manage IIS settigs(windows hosting plan only)
  • domain registration and dns records control
  • email setup and manage
  • security control(like password protect,security guard,file permission…)
  • hosting report(such as disk usage,website statistic,cp login log…)
  • And more…

You can try out webhost4life’s control panel here

Posted in Uncategorized at June 9th, 2009. No Comments.

Firewall Alert

When you host website with webhost4life you may get firewall alert message on your web pages. What does that mean and how to fix it?

Webhost4life has implemented a new security setting to prevent hotlinking contents from other sites and tighten your entire site security.

"Hotlinking" is a direct linking to a web site’s files (images, video, etc.). An example would be using an img tag to display a JPEG image you found on someone else’s web page so it will appear on your own site, eBay auction listing, weblog, forum message post, etc…

If someone hotlinks your content with the link http://yourdomain.com/xxx in another domain and then the firewall alert will appear on that site. And if you have several  websites hosted with webhost4life and one of your website’s contents directly linked from other websites you will also get this alert  on that site.

Except hostlinking this security setting will also block HTTP headers with strange characters.

You can login your Hosting control panel at webhost4life and then go to Security -> Security Guard to set the security guard to medium level then the firewall  alert message will be removed.

Posted in Uncategorized at June 9th, 2009. 1 Comment.

DNN user Login and Logout Options Settings

When you manage a DNN website you may want to redirect the user to another page instead of the default page when the user login and logout the site.Here is hte tutorial about how to do that:

  1. Navigate to Admin > Security Roles – OR – Select Roles iconbar_roles.gif from the Control Panel – OR Navigate to Admin > User Accounts – OR – Select Usersiconbar_users.gif from the Control Panel.
  2. Select settings_module.gif User Settings from the module menu – OR – click the settings_module.gif User Settings link.
  3. Go to the User Account Settings section.
  4. At Redirect After Login, select a page to redirect users to when they login to the portal. To disable redirection choose the ‘blank’ option at the top of the pages list.
  5. At Redirect After Logout, select a page to redirect users to when they logout of the portal. To disable redirection choose the ‘blank’ option at the top of the pages list.
  6. At Require a valid Profile for Login, check check.gif to require users to enter a valid profile during login or uncheck uncheck.gif to disable. This setting is unchecked by default.
  7. Click the Update link.

Webhost4life specializes in DotNetNuke Web Hosting.They are currently offering a one-step installation utility called auto-installer that will have you up and running with DotNetNuke in no time!That makes life much easier. Let’s go and try this out at webhost4life.

Posted in Uncategorized at June 8th, 2009. 1 Comment.