[英]How do I redirect the URL depending on the subdomain?
I'm trying to do a subdomain-specific redirection I am currently on. 我正在尝试执行我当前正在使用的特定于子域的重定向。 Is possible to make the redirection depends of subdomain?
是否可以使重定向取决于子域?
Is it possible to do subdomain-specific redirection? 是否可以进行特定于子域的重定向?
The Polish version of my website: mywebsite.pl 我的网站的波兰语版本:mywebsite.pl
English version: en.mywebsite.pl 英文版:en.mywebsite.pl
I have this in my .htaccess file: 我的.htaccess文件中有此文件:
# Change WordPress search URL RewriteCond %{QUERY_STRING} ^s=([^&]+) [NC] RewriteRule ^$ /oferty/\\?search_keywords=%1 [R=301,L]
But there is problem that the redirection works only for Polish version (even I am using English subdomain) - it redirects to mywebsite.pl 但是存在一个问题,即重定向仅适用于波兰语版本(即使我使用的是英语子域),它也重定向到mywebsite.pl
Now I would like to redirect: 现在,我想重定向:
If is en.mywebsite.pl
如果是
en.mywebsite.pl
Redirect the args: ?s=TEST
重定向参数:
?s=TEST
For en.mywebsite.pl/jobs/?search_keywords=TEST
对于
en.mywebsite.pl/jobs/?search_keywords=TEST
But if is the Polish version mywebsite.pl
但是如果是波兰文版本
mywebsite.pl
Redirect it for: mywebsite.pl/oferty/?search_keywords=TEST
将其重定向为:
mywebsite.pl/oferty/?search_keywords=TEST
Can somone help me with it? 有人可以帮我吗?
I really do not know how to make it. 我真的不知道该怎么做。 Thank you in advance.
先感谢您。
Thank you for help. 谢谢你的帮助。
I found solution by myself: 我自己找到了解决方案:
For the English version: 对于英文版:
# Change WordPress search URL RewriteEngine on RewriteCond %{HTTP_HOST} ^(www\\.)?en.mywebsite.pl$ [NC] RewriteCond %{QUERY_STRING} ^s=(.*)$ RewriteRule ^$ /jobs/\\?search_keywords=%1 [R=301,L]
And for the Polish version: 对于波兰语版本:
RewriteEngine on RewriteCond %{HTTP_HOST} ^(www\\.)?mywebsite.pl$ [NC] RewriteCond %{QUERY_STRING} ^s=(.*)$ RewriteRule ^$ /oferty/\\?search_keywords=%1 [R=301,L]
Grettings! 礼物!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.