Php htaccess替换域并添加语言
我尝试了几种方法,但我需要一些重定向规则方面的帮助:( 我需要的是 将domainA.com/pagename.php重定向到domainB.com/pagename.php?lang=EN 及 将domainA.com/directory/pagename.php重定向到domainB.com/directory/pagename.php?lang=EN 我试过这样的东西Php htaccess替换域并添加语言,php,.htaccess,redirect,Php,.htaccess,Redirect,我尝试了几种方法,但我需要一些重定向规则方面的帮助:( 我需要的是 将domainA.com/pagename.php重定向到domainB.com/pagename.php?lang=EN 及 将domainA.com/directory/pagename.php重定向到domainB.com/directory/pagename.php?lang=EN 我试过这样的东西 Options +FollowSymlinks RewriteEngine on RewriteBase / Rewri
Options +FollowSymlinks
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^domainA.com
RewriteRule ^(.*) http://domainB.com/$1?lang=EN [P]
及
但是它不起作用。你能试试这样的吗
<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>
重新启动发动机
重写规则^pagename.php$http://domainB.com/pagename.php?lang=EN [R=301]
重写规则^directory/pagename.php$http://domainB.com/directory/pagename.php?lang=EN[R=301]
试试下面的
RewriteEngine On
RewriteRule ^(directory)?/([^/]+)$ http://domainB.com/$2?lang=EN [R=301,L]
RewriteEngine On
RewriteRule ^(directory)?/([^/]+)$ http://domainB.com/$2?lang=EN [R=301,L]