cshelswell's avatar

index.php getting in to some URLs

I'm just doing some SEO using Google's webmaster tools and have come across something a bit strange on some occasions people seem to be getting to links like:

https://www.mystore.com/index.php/store/view-products/my-product

I'm not sure how the index.php bit is getting in there. The link still works but i'd prefer it not to be there.

I always use blade and link like this:

<a href="{{ url('store/view-products/my-product')">My Product</a>

So I'm just curious as to how the index.php in some links and if there's a a way I can test / search to find out any way this is happening.

Thanks

0 likes
3 replies
Snapey's avatar

probably because they take a guess at 'lets see if this domain has an index.php page' so the robot downloads index.php and find all these links like store/view-products/my-product and since these are relative links (don't start with backslash) then the search engine trys index.php/store/view... etc and gets back valid content.

Ideally, what you should do is put in a route to redirect (302) index.php to / .

If this is difficult, perhaps just put / on the front of all your links.

<a href="{{ url('/store/view-products/my-product')">My Product</a>
1 like
cshelswell's avatar

@Snapey ah great that explains it thanks. I'll give the prefix "/" a go. That should be easy.

It's not a big problem but I did just wonder what was going on.

Thanks for the help

intrepidws's avatar

@SNAPEY - Is there a good way to prevent access to URLs like this, that contain the index.php?

Please or to participate in this conversation.