Code: Select all
Options +FollowSymLinks +ExecCGI
<IfModule mod_rewrite.c>
RewriteEngine On
# uncomment the following line, if you are having trouble
# getting no_script_name to work
RewriteBase /
# we skip all files with .something
RewriteCond %{REQUEST_URI} \..+$
RewriteCond %{REQUEST_URI} !\.html$
RewriteRule .* - [L]
# we check if the .html version is here (caching)
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
# no, so we redirect to our front web controller
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
# big crash from our front web controller
ErrorDocument 500 "<h2>Application error</h2>symfony application failed to start properly"Code: Select all
RewriteRule .* - [L]I'll explain.
Symfony takes my URL:
http://trunk.swiftmailer.org/source/Swi ... ending.php
Which actually points to this real URL (note the index.php/path)
http://trunk.swiftmailer.org/index.php/ ... ending.php
Symfony then does some further processing the route the request in the front controller.
It does work if I map something like:
http://trunk.swiftmailer.org/source -> http://trunk.swiftmailer.org/index.php/source
But with the first example where a ".php" exists and the end if the URI I just get a 404 from apache. Taking out the "RewriteRule .* - [L]" fixes the issue but I'd like to know what that rule actually does so I can be sure I'm not breaking anything by removing it. Maybe there's a longer way to write the same rule?
Cheers
EDIT | I have read the apache documentation for mod_rewrite but didn't see it in there.