Neubreed blog
Automatically switch Symfony front web controllers using .htaccess
Submitted by ryan on Mon, 21/07/2008 - 13:33
Ok here's a quick tutorial on how to enable application switching in Symfony with minimal fuss ... yes we love the sound of that!
Modify your .htaccess file
Edit your web/.htacces file and locate the lines that look like this:
# no, so we redirect to our front web controller RewriteRule ^(.*)$ index.php [QSA,L]
Duplicate the above and modify to your linking:
# no, so we redirect to our back web controller RewriteRule ^myadmin(.*)$ admin.php [QSA,L] # no, so we redirect to our front web controller RewriteRule ^(.*)$ index.php [QSA,L]
The ^myadmin(.*)$ is the URL so you should have no pages on your public application that start with this.
Update your routing.yml
Edit your backend/config/routing.yml file like so:
homepage:
url: /myadmin
param: { module: default, action: list }
default_symfony:
url: /symfony/:action/*
param: { module: default }
default_index:
url: /myadmin/:module
param: { action: index }
default:
url: /myadmin/:module/:action/*Call now on 1300 858 495 or contact us online to discuss your needs.
- Call 1300 858 495
- Our portfolio
- Why choose us?
- Contact us
- Web design
- Flash design
- XHTML / CSS
- Web design portfolio
- Web usability
- Graphic design
- Logo design
- Business cards & stationery
- Press advertisements