Archive for December, 2014

Web hosting and domain names bound pseudo-static rule 301 Jump .htaccess 301 redirect

.htaccess apache This module is regarded as one called it expanded to show the template,To make it possible to run must RewriteEngine:Let's rewrite the following features on or off。on open;is closed off,Possible。

Redirect Old domain name .com to www. New domain name .com.

 

Code is as followsCopy the code

RewriteEngine On
RewriteCond %{HTTP_HOST} !Old domain name .com $ [NC]
RewriteRule ^(.*)$ http://www. new domain name .com / $ 1 [L,R=301]

Redirect Old domain name .com to the new domain name .com

Code is as followsCopy the code

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !Old domain name .com $ [NC]
RewriteRule ^(.*)$ http://The new domain name .com / $ 1 [L,R=301]

重定向domain.com/file/file.php 到 otherdomain.com/otherfile/other.php

Code is as followsCopy the code

RewriteCond %{HTTP_HOST} ^www.domain.com$
RewriteRule ^file/file.php$ http://www.otherdomain.com/otherfile/other.php [R = 301, L]

RewriteBase /news
RewriteCond %{HTTP_HOST} ^www.111cn.net [NC]
RewriteRule com(.*)$ http://www.111cn.net$1 [L,R=301]

#Not slash the requested address is /wwwroot/www.111cn.net/news/

Code is as followsCopy the code

RewriteCond %{HTTP_HOST} ^www.111cn.net [NC]
RewriteRule (.*)$ http://www.111cn.net/news/$1 [L,R=301]

RewriteCond %{HTTP_HOST} ^124.173.133.154 [NC]
RewriteRule com(.*)$ http://www.111cn.net$1 [L,R=301]

RewriteCond %{HTTP_HOST} ^124.173.133.154 [NC]
RewriteRule (.*)$ http://www.111cn.net/news/$1 [L,R=301]

# Modify the following statement / discuz address for your Groups directory,If the program is placed in the root directory,Please / discuz modify /
RewriteBase /

# Rewrite rules do not modify the system

Code is as followsCopy the code

RewriteCond %{HTTP_HOST} !^www.111cn.net$ [NC]
RewriteRule ^(.*)$ http://www.111cn.net/$1 [L,R=301]
RewriteRule ^archiver/((in|time)-[w-]+.html)$ archiver/index.php?$1
RewriteRule ^forum-([0-9]+)-([0-9]+).html $ forumdisplay.php?at $ 1 =&page=$2
RewriteRule ^thread-([0-9]+)-([0-9]+)-([0-9]+).html $ viewthread.php?Time = $ 1&extra=page=$3&page=$2
RewriteRule ^space-(username|uid)-(.+).html$ space.php?$1=$2
RewriteRule ^tag-(.+).html$ tag.php?name=$1

[NC]:no case of abbreviations。Means ignore case,a-z and A-Z is no difference。
[NC,OR]:OR=AND。It meant to be followed under a grammatical sentence。
[R = 301, L]:R=301:redirect Abbreviation。It means using the 301 permanent steering (when the URL in the list above,Automatically redirected to the URL you specify);L:Last Abbreviation,Meaning that the last sentence。

Comments

Linux uses parted partitioning tool at greater than 2T hard disk partition

purpose:In centos 5.4 system,Parted with the partition function 12T hard drive and formatted into ext4,12T divided into two partitions,A 7.5T,Another 4.5T.
In linux large disk partitions can not use the fdisk,2T only support MBR partition table disk,So more than 2T disk must use the GPT partition table。The following describes specific steps:
1.It is divided into two primary partitions

 

[root@localhost ~]# parted /dev/sdb # Using parted to GPT disks operation,Enter the interactive mode
GNU Parted 1.8.1 Using /dev/sdb Welcome to GNU Parted! Type ‘help’ to view a list of commands.
(parted) mklabel gpt # The MBR disk to GPT format
(parted) print # print the current partition
(parted) mkpart primary 0 4.5TB # Points a 4.5T primary partition
(parted) mkpart primary 4.5TB 12TB # Points a 7.5T primary partition
(parted) print # print the current partition
(parted) quit 退出
Information: Don’t forget to update /etc/fstab, if necessary.

 

2.Then formatted into ext4,You need to install the package e4fsprogs.x86_64(yum install e4fsprogs.x86_64)To

[root@localhost ~]# mkfs.ext4 /dev/sdb1
[root@localhost ~]# mkfs.ext4 /dev/sdb2

 

3.Then mount the partition with the mount

[root@localhost]# mount -t ext4 /dev/sdb1 /bk
[root@localhost]# mount -t ext4 /dev/sdb2 /mail
[root@localhost ~]# df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev / sda6 ext3 39G 9.4G 28G 26% /
/dev/sda1 ext3 122M 13M 103M 12% /boot
none tmpfs 1004M 0 1004M 0% /dev/shm
/dev/sdb1 ext4 4.1T 194M 3.9T 1% /bk
/dev / sdb2 ext4 6.8T 179M 6.4T 1% /mail

 

4.Last modified / etc / fstab,Add the following two lines,Let it boot automatically mount.

/dev/sdb1 /bk ext4 defaults,noatime 1 2
/dev/sdb2 /mail ext4 defaults,noatime 1 2

 

Comments