[英]htaccess replace domain and add language
I've tried a few way, but I need some help with the redirect rules :( 我已经尝试了几种方法,但是我需要一些有关重定向规则的帮助:(
What I need is 我需要的是
Redirect domainA.com/pagename.php to domainB.com/pagename.php?lang=EN 将domainA.com/pagename.php重定向到domainB.com/pagename.php?lang=EN
And 和
Redirect domainA.com/directory/pagename.php to domainB.com/directory/pagename.php?lang=EN 将domainA.com/directory/pagename.php重定向到domainB.com/directory/pagename.php?lang=EN
I've tried something like this 我已经尝试过这样的事情
Options +FollowSymlinks
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^domainA.com
RewriteRule ^(.*) http://domainB.com/$1?lang=EN [P]
And 和
Options +FollowSymlinks
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_URI} [NC]
RewriteRule ^(.*)$ /$1?lang=EN [L]
But it doesn't work. 但这是行不通的。
Can you try something like this, 你可以尝试这样的事情吗
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^pagename.php$ http://domainB.com/pagename.php?lang=EN [R=301]
RewriteRule ^directory/pagename.php$ http://domainB.com/directory/pagename.php?lang=EN[R=301]
</IfModule>
Try with below, 尝试以下
RewriteEngine On
RewriteRule ^(directory)?/([^/]+)$ http://domainB.com/$2?lang=EN [R=301,L]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.