Because the blog is used as a blog www.jzread.com domain name, so want to achieve all jzread.com redirect (jump) to www.jzread.com. At the same time in accordance with the recommendations of Google, the use of server-side 301 redirect, in order to ensure that users and search engines to the correct page the best way. 301 status code indicates that a web page has been permanently migrated to a new location. The following will find out about apache 301 permanent redirect 2 methods, you need to have access to the server's. Htaccess file permissions.
Apache module mod_alias the Redirect and RedirectMatch command
The two commands mentioned above are used in a similar way. The difference is that the latter RedirectMatch based on the regular expression matching the current URL to send an external redirect syntax is:
Redirect [status] URL-path URL
RedirectMatch [status] regex URL
The status parameter can use the following HTTP status code:
permanent
Returns a permanent redirect status code (301) indicating that the location change for this resource is permanent.
temp
Returns a temporary redirect status code (302), which is the default.
seeother
A "see" status code is returned (303) indicating that this resource has been replaced.
gone
An "obsolete" status code is returned (410) indicating that this resource has been permanently deleted. If you specify this status code, the URL parameters will be ignored.
Example:
APACHE
Redirect 301 /old/old.htm http://www.jzread.com/new.htm
Redirect permanent / one http://jzread.com/two
RedirectMatch 301 (. *). Gif $ http://www.jzread.com/images/$1.jpg
Use mod_rewrite to rewrite the URL
APACHE
Options + FollowSymLinks
RewriteEngine on
RewriteCond% {HTTP_HOST} ^ jzread.com
RewriteRule ^ (. *) $ Http://www.jzread.com/$1 [R = permanent, L]
Here to determine the current server variable HTTP_HOST is equal to jzread.com, to really rewrite, permanent redirection according to R = permanent, L said and immediately stop rewriting, and no longer apply other rewrite rules
Here's my final implementation of the .htaccess file, which also incorporates wordpress rewrite rules.
APACHE
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
#Redirect
Options + FollowSymLinks
RewriteCond% {HTTP_HOST} ^ jzread.com $
RewriteCond% {HTTP_HOST}! ^ $
RewriteRule ^ (. *) $ Http://www.jzread.com/$1 [R = 301, L]
#Rewrite (blog)
RewriteCond% {REQUEST_FILENAME}! -f
RewriteCond% {REQUEST_FILENAME}! -d
RewriteRule ^ blog /.* /blog/index.php [L]
RewriteRule. -
</ IfModule>
# END WordPress
Article source: jzread.com