Apache子域重定向
我有一个子域(称为 subdomain.mydomain.com)
我只想将一个页面(例如:www.mydomain.com/page1.php)重定向到我的子域
因此,当我加载 subdomain.mydomain.com 时,我想转到 www .mydomain.com/page1.php 但在 url 中保留我的子域
使用 htacess 或 virtualhost
这是我编辑的代码和您的评论
Options +FollowSymLinks -MultiViews
RewriteEngine on
RewriteCond %{QUERY_STRING} (^|&)com=who(&|$) [NC]
RewriteCond %{HTTP_HOST} ^www\.mysite\.fr$ [NC]
RewriteRule ^index\.php/?$ http://apropos.mysite.fr/? [NC,L,R]
RewriteCond %{HTTP_HOST} ^apropos\.mysite\.fr$ [NC]
RewriteRule ^$ http://www.mysite.fr/index.php?com=who [L,P,QSA]
I have a subdomain (called subdomain.mydomain.com)
I just want that a page (ex: www.mydomain.com/page1.php) redirects to my subdomain
So when i load subdomain.mydomain.com i want to go to www.mydomain.com/page1.php but conserving my subdomain in the url
Using htacess or virtualhost
here is my edited code with your comments
Options +FollowSymLinks -MultiViews
RewriteEngine on
RewriteCond %{QUERY_STRING} (^|&)com=who(&|$) [NC]
RewriteCond %{HTTP_HOST} ^www\.mysite\.fr$ [NC]
RewriteRule ^index\.php/?$ http://apropos.mysite.fr/? [NC,L,R]
RewriteCond %{HTTP_HOST} ^apropos\.mysite\.fr$ [NC]
RewriteRule ^$ http://www.mysite.fr/index.php?com=who [L,P,QSA]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以在 ROOT .htaccess 中尝试以下代码:
You can try following code in your ROOT .htaccess:
尝试将以下内容放入站点根目录中的 .htaccess 中。我假设您的子域和域共享相同的根。
Try putting the following in the .htaccess in the root directory of you site. I am assuming that your subdomain and domain share the same root.