admin管理员组文章数量:1332377
I'm trying to write a redirect so that anyone who tries visiting "www.example.au" is directed to "www.example", but I'm not sure how to do that in my .htaccess file.
So far, I've tried:
RedirectMatch 301 ^.au /
RedirectMatch 301 /
RedirectMatch 301 ^.au /
But I'm not seeing any results. What's the proper way to setup this redirect?
I'm trying to write a redirect so that anyone who tries visiting "www.example.au" is directed to "www.example", but I'm not sure how to do that in my .htaccess file.
So far, I've tried:
RedirectMatch 301 ^.au /
RedirectMatch 301 https://www.example.au /
RedirectMatch 301 ^.au /
But I'm not seeing any results. What's the proper way to setup this redirect?
Share Improve this question asked Jul 6, 2020 at 13:42 James RandolphJames Randolph 1 2- Added an answer, and for reference note this isn't specifically a Wordpress question, even though it may be to do with a Wordpress site for you. You may find this quesiton gets closed or you get better results for non Wordpress questions on stack overflow or server fault – mozboz Commented Jul 6, 2020 at 14:09
- What you describe is not a "subdomain" redirect; it's an entirely different domain. – MrWhite Commented Jul 6, 2020 at 15:07
1 Answer
Reset to default 1Found answer here, first result by searching redirect to different domain apache htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.au$ [OR]
RewriteCond %{HTTP_HOST} ^www.example.au$
RewriteRule (.*)$ http://www.example/$1 [R=301,L]
</IfModule>
It doesn't matter if just your TLD is different the same format will work
本文标签: htaccessHow do I write a subdomain redirect
版权声明:本文标题:htaccess - How do I write a subdomain redirect? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742288836a2447423.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论