admin管理员组文章数量:1125924
I used Polylang plugin to add multilingual system to my website. But I have removed the Polylang and the multilingual system.
I want to redirect these multilingual website to my domain. Instead of example/ja, I want to get the website on example.
Do you know a way to make this redirection ?
I used Polylang plugin to add multilingual system to my website. But I have removed the Polylang and the multilingual system.
I want to redirect these multilingual website to my domain. Instead of example.com/ja, I want to get the website on example.com.
Do you know a way to make this redirection ?
Share Improve this question edited Jan 24, 2024 at 10:07 user239456 asked Jan 24, 2024 at 10:04 user239456user239456 11 bronze badge 1- Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. – Community Bot Commented Jan 24, 2024 at 16:13
1 Answer
Reset to default 0Normally I use the .htaccess to redirect a url like this. To redirect the multilingual URLs to your main domain using .htaccess, you can set up rewrite rules that redirect any requests for the specific language subdirectories to your main domain. Here's a basic guide on how you can achieve this:
Access Your .htaccess File: The .htaccess file is usually located in the root directory of your WordPress website. You'll need to access it via FTP or through your hosting file manager.
Back Up .htaccess File: Before making any changes, it's crucial to back up your existing .htaccess file. This allows you to restore the original settings in case something goes wrong.
Edit .htaccess File: Open the .htaccess file in a text editor.
Add Redirection Rules: You'll need to add rules that specifically redirect URLs from the language subdirectories to your main domain. Below is a sample rule for redirecting Japanese (/ja) URLs:
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/ja/(.*)$
RewriteRule ^ja/(.*)$ https://example.com/$1 [R=301,L]
In this rule:
RewriteEngine On ensures that the rewrite engine is enabled. RewriteCond %{REQUEST_URI} ^/ja/(.)$ checks if the requested URL is in the Japanese subdirectory. RewriteRule ^ja/(.)$ https://example.com/$1 [R=301,L] redirects the URL to the main domain. R=301 signifies a permanent redirect, and L means this is the last rule to be applied if this condition matches. Repeat for Other Languages: If you had other languages, repeat the process by replacing /ja/ with the respective language code in the rewrite condition and rule.
Save and Upload .htaccess File: After adding the necessary rules, save your .htaccess file and upload it back to the server.
Test the Redirection: Visit the URLs of the different language subdirectories to ensure that they are properly redirected to your main domain.
Please note:
Replace example.com with your actual domain name. Ensure that the syntax is correct and there are no typographical errors in the .htaccess file, as even a small mistake can make your website inaccessible. The redirection might take some time to propagate. If it doesn't work immediately, clear your browser cache and try again.
本文标签: plugin polylangRedirect WordPress multilingual website to the domain
版权声明:本文标题:plugin polylang - Redirect WordPress multilingual website to the domain 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736678186a1947291.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论