I discovered that any laravel website is accessible with index.php as a parameter.
This is a big problem, index.php in url parameter breaks all images.
Look at a real example to understand what I mean:
http://www.cyprusalive.com/main-thing/sightseeing
http://www.cyprusalive.com/index.php/main-thing/sightseeing
Googlebot read some urls with index.php as a parameter of url. This has effect to breaks all images when someone get access to the website from google search with index.php.
Also, this is a bad seo practice because produce duplicate content.
What is the best way to fix that?
4
Answers
The problem could be fixed with nginx rewrite rules. Using the bellow rule redirect all urls with
index.php
parameter to theoriginal laravel route url
Also I've put the follow to the
robots.txt
Do you have the
.htaccess
file provided with Laravel in your webroot or public folder?If not, try putting this in a
.htaccess
file in your public directory:Directly taken this
.htaccess
from Laravel GitHub.Also, you might need to check if the rewrite mod is enabled for your webserver.
Reference How to check whether mod_rewrite is enable on server?
Since you’re using NGINX, check this
Also you can do this simply……
1.Open apacheconfhttpd.conf and search for this line
#LoadModule rewrite_module modules/mod_rewrite.so
2.then remove [#] and save,then restart apache