301 redirect is being delivered. Used to redirect the user to a different URL (page or site item) than the original request. For example, when the staffing in the address bar is correct, your site. If you use COM, please visit www.your-site. Move to com or vice versa. It also helps you achieve these redirects while maintaining existing traffic and SEO. 5 types of URL redirection 301 – permanent redirection. Used to notify search engines that the page location has been permanently changed. 99.44% use this type. 302 – temporary redirection. Used to notify search engines that the page location has never changed. 303 – see other redirects. Sometimes, online stores are used to check whether pages with one-time data are added to tabs or just updated. This response code tells the browser that even if the original query is executed in a different way, the requested document must be requested through the get method. Used to replace the HTTP response code 302.1\/1 in the protocol. 307 – \
How to do this using the redirection plug-in. Let’s see how to edit the htaccess file. In this case, the process of manually adding redirection to the word press redirection plug-in website. Htaccess files can be very complex because they need to be edited. However, the WordPress world has John Godley’s fantastic redirection plug-in, which can handle redirection directly on the WordPress console. The plug-in is popular because it has been on the market for a long time and it is easy to import the address list into the table, so you don’t need to enter all redirects manually.
To install the male plug-in, simply enter \
The code editor is required for editing, and the code and format of the end of the line can be specified, such as Notepad++
. redirect example: redirect from HTTP to HTTPS, including all website links. http:\/\/example.com B https:\/\/example.com Redirect to. After connecting the SSL certificate, you must add the necessary redirection from HTTP to HTTPS to encrypt all connections. These redirects exclude the possibility of connecting through the HTTP protocol. If you want to. Insert the following code at the beginning of the htaccess file:
# BEGIN Redirect
RewriteEngine On
RewriteCond% {HTTP: X-Forwarded-Proto}! Https
RewriteRule ^ (. *) $ Https: \/\/% {HTTP_HOST}% {REQUEST_URI} [L, R = 301]
# END Redirect
Www.example, including redirected links from WWW to non www. Com. Redirect to com: #begin redirect
RewriteEngine On
RewriteBase \/
RewriteCond% {HTTP_HOST} ^ www. (. *) $ [NC] RewriteRule ^ (. *) $ Http: \/\/% 1 \/ $ 1 [R = 301, L]
# END Redirect
If SSL certificate is included, note the following lines:
RewriteRule ^ (. *) $http: \/ \/% 1 \/ $1 [R = 301, l] worth changing: RewriteRule ^ (. *) $HTTPS: \/ \/% 1 \/ $1 [R = 301, l] redirect from non WWW to www#begin redirect
RewriteEngine On
RewriteCond% {HTTP_HOST}! ^ Www.
RewriteRule ^ (. *) $ Http: \/\/www.% {HTTP_HOST} \/ $ 1 [R = 301, L]
# END Redirect
If SSL certificate is included, note the following lines:
RewriteRule ^ (. *) $http: \/ \/ www.% {http_host} \/ $1 [R = 301, l] is worth the following changes: RewriteRule ^ (. *) $HTTPS: \/ \/ www.% {http_host} \/ $1 [R = 301, l] when setting redirection, you must add WWW and change the site name in the database. You must edit the row to do this in phpMyAdmin. The siteurl and home of the wp_options table (if the table prefix of the database is \
To use multiple redirects above redirects in the. Htaccess file, you must create them in the following order. www.example. Com. Redirect to com or example. COM is www.example. Redirect to com. http:\/\/example.com B https:\/\/example.com Redirect to. In particular, there are many other rules for using regular expressions. However, they are separate and not as often needed as described above, which is beyond the scope of this article. If you need to write more complex redirection rules, it is recommended to check the documentation of Apache 2 web server and its mod_rewrite module and regular expressions in PCRE format.
https:\/\/httpd.apache.org\/docs\/2.4\/mod\/mod_rewrite.html https:\/\/httpd.apache.org\/docs\/2.4\/rewrite\/ http:\/\/pcre.org\/current\/doc\/html\/