Skip to content
This repository was archived by the owner on Nov 27, 2020. It is now read-only.

redirect /app.php to prevent duplicate content #497

Merged
merged 3 commits into from
Feb 22, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions UPGRADE-2.2.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
UPGRADE FROM 2.1 to 2.2
=======================

* The [`web/.htaccess`](https://github.com/symfony/symfony-standard/blob/2.2/web/.htaccess)
file changed slightly to prevent duplicate content with and without `/app.php` in the URI.
So you might want to update your `.htaccess` file as well.

* The ``_internal`` route is not used any more. It should then be removed
from both your routing and security configurations. A ``framgents`` key has
been added to the framework configuration and must be specified when ESI or
Expand Down
6 changes: 5 additions & 1 deletion web/.htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
# RewriteBase /
#</IfModule>

# redirect to URI without front controller to prevent duplicate content
RewriteRule ^app\.php(/(.*)|$) /$2 [R=301,END]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think (.*) is useless here

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just kidding :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens when $2 is undefined ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Params in subpattern are usually initialized emty. Anyway, I tested it and no problems encountered.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok then looks all good to me. Thanks.


# rewrite requests to non-existent files to front controller
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app.php [QSA,L]
RewriteRule ^(.*)$ app.php [END]
</IfModule>