[英]Rewrite/redirect urls to subdomain
I have an add-on on domain that is finally registered and can be accessed without the main domain. 我在域上有一个附加组件,该附加组件最终已注册,可以在没有主域的情况下进行访问。 The add-on domain have been used like this: (I didn't find similar domain setup to help me out with this) 附加域的用法如下:(我没有找到类似的域设置来帮助我解决此问题)
primary.com/secondary.de/ primary.com/secondary.de/
primary.com/secondary.de/files primary.com/secondary.de/files
primary.com/secondary.de/files/file primary.com/secondary.de/files/file
I'd like to redirect users to: 我想将用户重定向到:
secondary.de/ secondary.de/
secondary.de/files secondary.de/files
secondary.de/files/file secondary.de/files/file
addresses. 地址。 What expressions should I use in my htacces file? 我应该在htacces文件中使用哪些表达式?
Thanks 谢谢
Since this is WP install, put this code in your .htaccess
under DOCUMENT_ROOT/secondary.de
directory: 由于这是WP安装,因此请将此代码放在DOCUMENT_ROOT/secondary.de
目录下的.htaccess
:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^(www\.)?primary\.com$ [NC]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+(secondary\.de/[^\s]*) [NC]
RewriteRule ^ http://%1 [NE,R=301,L,NC]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.