Replies: 2 comments 3 replies
-
This is an issue with PHP in general, not unique to Laravel:
The redirect solution noted in that SO answer (or even better, handled in the web server configuration instead of in PHP) is enough to take care of the issue. Arbitrarily redirecting with |
Beta Was this translation helpful? Give feedback.
1 reply
-
|
Interesting what generates this. Is this index.php added to the sitemaps? |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
This one's a bit random.
For the sake of illustrating the point, I've built a bog-standard Laravel site with a page in it: https://mysite.com/my-page. The page works and can be loaded in any browser as you would expect.
Google have somehow indexed a version of the page with '/index.php/' in its URL: https://mysite.com/index.php/my-page.
The same behaviour seems to be present in all Laravel sites. These pages (which I assume are built in Laravel???) can all be visited without any redirects being triggered:
https://laravel.com/index.php
https://laravel.com/index.php/docs/12.x
https://laracasts.com/index.php/series
https://laravel-news.com/index.php/authentication-with-laravel-and-mongodb
laravel-news.com has the same (properly formatted) canonical tag in the head regardless of /index.php/ being present in the URL. I couldn't find any canonical tags on the Laracasts site. Those in laravel.com pages DO include the errant /index.php/. when it's present in the URL. e.g.
<link rel="canonical" href="https://laravel.com/index.php/docs/12.x/installation">I've set up a redirect based on an old Stack Overflow answer here, so don't believe this will be a problem for my site in the future, but I was surprised this manual intervention was necessary. I would have assumed that a redirect for page requests that include index.php would be a default Laravel feature.
What am I missing? Is it a deliberate choice to let the index.php versions of pages coexist with the regular pages? If so, what's the use case? I'm no SEO expert, but is this not a potential SEO problem for all sites built with Laravel?
Beta Was this translation helpful? Give feedback.
All reactions