Bug Report #1159
All URLs containing index.php will default to home page without 301
| Status: | Closed | Start date: | ||
|---|---|---|---|---|
| Priority: | High | Due date: | ||
| Assignee: | - | % Done: | 100% |
|
| Category: | Core | |||
| Target version: | 2.3.3 | |||
| Resolution: | fixed | Points: |
Description
Any url that contains index.php will default to the home page without a 301. The Router assumes that mysite.com/anyfolder/index.php is the really mysite.com/index.php. This can cause serious issues with SEO if older urls like mysite.com/goodfolder/index.php?query are removed. Instead of redirecting with a 301 a search engine will see duplicate content on the home page for all urls that use ...index.php?something.
Also, any application that uses controller/method = index and sets config['url_suffix'] = '.php'; will cause the same problem.
Related issues
Associated revisions
Fixing #1159.
History
Updated by Chris Bandy over 2 years ago
In my testing with Apache 2.2.11, the front controller only needed to be stripped when PATH_INFO was unavailable. Stripping DOCROOT from the running filename is already done in the front controller, so I used the resulting constant, KOHANA, instead.
This patch works for me with and without controller in the URL (aka rewriting) and with or without $config['url_suffix'] = '.php'.
Updated by Chris Bandy over 2 years ago
I can confirm that lighttpd 1.4.20 with the below configuration is also affected by this bug and also fixed by this patch.
url.rewrite-once = (
# pretend the file extension can tell us it is static
"^.*\.(js|ico|gif|jpg|png|css|htm)(\?.*)?$" => "$0",
# rewrite all other requests except those to the front controller
"^/(?!index.php)(.+)$" => "/index.php/$1"
)
Updated by Jeremy Bush over 2 years ago
- Status changed from New to Closed
- % Done changed from 0 to 100
Applied in changeset r4350.
Updated by Jeremy Bush over 2 years ago
- Resolution set to fixed