This article describes the Redirect setting of the page (basic setting) using wordpress.
Regarding the setting of Redirect, it is a method realized by editing the “.htaccess” file.
In the basic permalink of wordpress, it is in the form of “? P = 123”.
For this form of URL, it takes some effort to redirect. Therefore, I will introduce the method here.
※In addition, we cannot guarantee any inconvenience / malfunction caused by this setting, so please edit at your own discretion / responsibility.
How to setting for Redirect
- Use an app that can connect to FTP and move to the directory of the server where wordpress is installed.
- Download the “.htaccess” file in the root directory where wordpress is installed to your Local PC.(Even if you have wordpress installed in a subdirectory, you can redirect it by setting the root directory to .htaccess)
- Open the downloaded “.htaccess” file with a text editor.(If you don’t have a text editor, you can open it with Notepad.)
- When you open the “.htaccess” file, there is a line with the following wordpress settings, but the redirect setting is described in the line above this.
← in this here, you need setting for redirect.
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
・
・
・
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
5. Added the following redirect description to “.htaccess”.(Two lines, the RewriteCond line and the RewriteRule line, make up one redirect instruction.)
NOTE:If you do not put “?” At the end of the redirect destination URL in the RewriteRule line, the Redirect process will be executed with a character string such as the redirect destination URL + “p=123” added, so you will go to a different page. It may fly. Don’t forget to set “?”.
# Redirect function
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{QUERY_STRING} ^p=123$ # ← Replace it with the number starting with "p=" on the redirect source page.
RewriteRule ^$ "https://〇〇〇/×××/?" [R=301,L] # ←Set the Redirect destination of the page specified above here
</IfModule>
6. Use syntax checker or etc. to check in advance whether there is a problem with the grammar of the edited content. (Please note that the website may not open if there is an error in the grammar.)
7. Overwrite the edited “.htaccess” file to the original location and upload it. (It is recommended to back up the file before overwriting as well)
8. To check if the redirect settings are working properly, enter the URL before the redirect into a site such as a redirect checker(like this), check the redirect transition, and check if it is as expected.
This completes the Redirect settings.