If you don't want to use
http://my_application.my_domain.net/index_dev.php
That does pretty much the same job, here the solution:
After having allowed your external IP to my_application/web/app_dev.php
// ...
if (isset($_SERVER['HTTP_CLIENT_IP'])
|| isset($_SERVER['HTTP_X_FORWARDED_FOR'])
|| !in_array(@$_SERVER['REMOTE_ADDR'], array(
'xxx.xxx.xxx.xxx', // <- your IP
// ...
))
) {
// ...
Configured /etc/apache2/ports.conf to tell Apache to listen in the additional port
#...
NameVirtualHost *:80
Listen 80
NameVirtualHost *:8081
Listen 8081
#...
Simply duplicate the applications vhost (if you are using one)
$ sudo cp /etc/apache2/sites-available/my_application \
/etc/apache2/sites-available/my_application_dev
and change the file pointed by the url rewriter
<VirtualHost *:8081>
ServerName my_application.my_domain.net
DocumentRoot "/var/www/my_application/web"
<Directory "/var/www/my_application/web/">
#...
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /app_dev.php [QSA,L]
</IfModule>
</Directory>
</VirtualHost>
Finally activate the new vhost
$ sudo a2ensite my_application_dev
$ sudo service apache2 restart