Symfony 2子域问题 [英] Symfony 2 problems with subdomain

查看:59
本文介绍了Symfony 2子域问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我认为我的htaccess有问题。

I think i have a problem with htaccess.

我有一个子域,该子域重定向到 subdomain.domain.com之类的文件夹- ->家庭/子域

I have a subdomain which redirects to a folder such as subdomain.domain.com --> home/subdomain

问题是,如果我写 subdomain.domain.com 不会重定向到app.php,如果我写subdomain.domain.com/app.php的话。

The problem is that if i write subdomain.domain.com is not redirected to app.php, if i write subdomain.domain.com/app.php it works.

另一方面,如果我写 domain.com/subdomain/web (假设这是通往应用程序的路径),则无需编写app.php。

On the other side if i write domain.com/subdomain/web (supossing that this is the route to the app) there is no need to write app.php.

因此可以同时使用:
domain.com/subdomain/web/和domain.com/subdomain/web/app.php

我具有以下htaccess:

I have the following htaccess:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app.php [QSA,L]
</IfModule>

我不知道htaccess

I have no idea about htaccess

PS:我不知道问题是否已经解决,我想在写subdomain / domain.com时直接访问subdomain.domain.com/app.php

PS: i don't know if the problem has been understood, i want to direcly acces subdomain.domain.com/app.php when i write subdomain/domain.com

推荐答案

RewriteEngine on 
RewriteCond %{HTTP_HOST} ^(.*)\.mydomain\.com$
RewriteCond %{HTTP_HOST} !^www\.mydomain\.com$
RewriteRule (.*) http://mydomain.com/%1$1 

检查此内容: http://www.sitepoint.com/getting-started-apache-mod_rewrite-methods/
并搜索子域

check this: http://www.sitepoint.com/getting-started-apache-mod_rewrite-methods/ and search for "sub-domain"

这篇关于Symfony 2子域问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆