Regex .htaccess域重定向-TLD agnositc
我想将short.tld重定向到longer.tld,而不管tld是dev还是com,也不管请求什么 所以像这样Regex .htaccess域重定向-TLD agnositc,regex,.htaccess,mod-rewrite,Regex,.htaccess,Mod Rewrite,我想将short.tld重定向到longer.tld,而不管tld是dev还是com,也不管请求什么 所以像这样 short.dev should redirect to longer.dev short.com should redirect to longer.com 到目前为止,我有一个正在工作的(for.dev): 。。。但是如何使重写规则中的.dev不可知于TLD?您可以使用类似的方法使其不可知于TLD的部分: RewriteCond %{HTTP_HOST} ^(?:www\.)?
short.dev should redirect to longer.dev
short.com should redirect to longer.com
到目前为止,我有一个正在工作的(for.dev):
。。。但是如何使重写规则中的.dev不可知于TLD?您可以使用类似的方法使其不可知于TLD的部分
:
RewriteCond %{HTTP_HOST} ^(?:www\.)?short\.(.+)$ [NC]
RewriteRule ^ http://longer.%1%{REQUEST_URI} [R=301,L]
意识到问题并修复。请检查编辑的代码。
RewriteCond %{HTTP_HOST} ^(?:www\.)?short\.(.+)$ [NC]
RewriteRule ^ http://longer.%1%{REQUEST_URI} [R=301,L]