Using PHP extension for symfony pages

Hi all,

I’m wondering if anyone ever needed to use .php extension for symfony pages. e.g. you may want to make your urls look like or If so here is the solution:

First of all dont forget to enabled suffix option in your apps/frontend/config/settings.yml:

suffix: .php

Then important to add the line which would take care of .php files in .htaccess file:

# we skip all files with .something
# comment the following 3 lines to allow periods in routes
RewriteCond %{REQUEST_URI} \..+$
RewriteCond %{REQUEST_URI} !\.php$
RewriteRule .* – [L]

In your routing.yml you use the same code as normally:

url: /mypage
param: { module: index, action: mypage }

And that’s it 🙂
We hope it was helpfull, wish you great day!

Leave a Reply

Your email address will not be published. Required fields are marked *