【发布时间】:2018-03-06 07:15:39
【问题描述】:
我需要将带有此 TLD (.it) 的任何请求重定向到此 TLD (.com) 例如:
http://example.it?i=3
到这里:
http://example.com?i=3
我们如何使用 htaccess 做到这一点?
【问题讨论】:
标签: php regex .htaccess url-redirection
我需要将带有此 TLD (.it) 的任何请求重定向到此 TLD (.com) 例如:
http://example.it?i=3
到这里:
http://example.com?i=3
我们如何使用 htaccess 做到这一点?
【问题讨论】:
标签: php regex .htaccess url-redirection
您可以在.ir 域的站点根目录.htaccess 中使用此规则:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(.+)\.ir$ [NC]
RewriteRule ^ http://%1.com%{REQUEST_URI} [L,R=301,NE]
【讨论】:
RewriteEngine on
RewriteCond %{HTTP_HOST} !^example\.com$
RewriteRule ^ http://example.com%{REQUEST_URI} [L,R=301]
一直尝试它的工作
【讨论】: