seipey
seipey

Reputation: 549

Symfony 2 problems with subdomain

I think i have a problem with htaccess.

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

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.

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.

So it works with both: domain.com/subdomain/web/ and domain.com/subdomain/web/app.php

I have the following htaccess:

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

I have no idea about htaccess

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

Upvotes: 0

Views: 913

Answers (1)

Rui Lima
Rui Lima

Reputation: 7403

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

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

Upvotes: 2

Related Questions