Pages

Bài đăng phổ biến

Tuesday, December 27, 2011

How to Redirect non-www to www by .htaccess


Redirect www to non-www:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www.yourdomain.com [NC]
RewriteRule ^(.*)$ http://yourdomain.com/$1 [L,R=301]

Redirect non-www to www:RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^yourdomain.com [NC]
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [L,R=301]


Both of these rules send a full search engine friendly 301 HTTP redirect. They also preserve the entire URL (so yoursite.com/redirects to www.yoursite.com/).
Search engines can usually figure out which format is preferred, but since you're showing the same page for www and non-www URLs it can't hurt to be consistent about it.

Nguyen Si Nhan

Backup Mssql while Mssql server is running

Script to backup all database mssql  :

DECLARE @name VARCHAR(50)
DECLARE @path VARCHAR(256)
DECLARE @fileName VARCHAR(256)
DECLARE @fileDate VARCHAR(20)

SET @path = 'C:\backup'

SELECT @fileDate = CONVERT(VARCHAR(20),GETDATE(),112)

DECLARE db_cursor CURSOR FOR
SELECT name
FROM master.dbo.sysdatabases
WHERE name NOT IN ('master','model','msdb','tempdb')

OPEN db_cursor
FETCH NEXT FROM db_cursor INTO @name

WHILE @@FETCH_STATUS = 0
BEGIN
SET @fileName = @path + @name + '_' + @fileDate + '.BAK'
BACKUP DATABASE @name TO DISK = @fileName with noinit

FETCH NEXT FROM db_cursor INTO @name
END

CLOSE db_cursor
DEALLOCATE db_cursor

 To backup daily or schedule to backup all database you should our script :
http://download.0937686468.com/sqlvn/backupdatabases.rar
(This app is written by my friend http://sqlvn.com )


How to use above application ? 
You just extract this file and edit file MrNhanApp.exe.config that I set the red color :
    <add key="ConnectionStr" value="server=1.1.1.1;database=master;uid=sa;pwd=1111"/>


Nguyen Si Nhan

Monday, December 26, 2011

Vituozzo : Install yum for vps

You just login server via ssh then type this cmd:
#vzpkg install -p containerID yum

That's all

Nguyen Si Nhan