konieckropka
konieckropka

Reputation: 469

mod_rewrite subdomain in Symfony2

Please help with mod_rewrite subdomain to some Symfony2 routing. It is like 3 months now I spent time to solve this with my Symfony2 project but after reading tons of apache mod_rewrite and mod_alias documentation and trying hundreds of examples... it still doesn't work!

What I try to solve is, when user enter address of some specific subdomain: XXXXXXX.example.com

He sees content that is actually under
www.domain.com/tag/XXXXXXX/

but he is not redirected or URL isn't changed -- it should just stay XXXXXX.example.com as he enters.

I need to resolve this with Apache VirtualHost and sites-enabled file (not with SubdomainListener) but the most I can solve on my own with mod_rewrite is having

XXXXXXX.example.com

Rewriting (transparently) itself to

XXXXXXXX.example.com/tag/XXXXXXXX or
XXXXXXXX.example.com/app.php/tag/XXXXXXXX/

which of course is not what I try to achieve. I try to achieve internal (http://httpd.apache.org/docs/2.2/rewrite/remapping.html) redirection so user don't see that. Any help with working soultions would be otherworldly appreciated.

Upvotes: 0

Views: 269

Answers (1)

r1pp3rj4ck
r1pp3rj4ck

Reputation: 1487

Since this commit, you can use subdomains in Symfony natively, but unfortunately it's a Symfony 2.2 feature. If you need subdomains, this still is the best way to do this, however.

Upvotes: 1

Related Questions