Gingechilla Posted October 25, 2015 Share Posted October 25, 2015 Hi, I'm not sure why but search engines are indexing the following urls on my site: domain.com/index.php/about-us domain.com/index.php/contacto domain.com/index.php/any-word-can-go-here These aren't URLs I'm using or are in my sitemap. Can anyone tell me how I can turn off these URLs after the .php ? I'm not sure why this is happening or what words to use to find out what my problem is. Quote Link to comment https://forums.phpfreaks.com/topic/298817-indexphprandom-word-here/ Share on other sites More sharing options...
scootstah Posted October 25, 2015 Share Posted October 25, 2015 Did those pages exist at any point? Quote Link to comment https://forums.phpfreaks.com/topic/298817-indexphprandom-word-here/#findComment-1524289 Share on other sites More sharing options...
Gingechilla Posted October 25, 2015 Author Share Posted October 25, 2015 Hi, No, never. You can write anything after index.php/ and the index.php file loads up. Any resources on the page with a relative url won't work though. So ../image.jpg will work on index.php but not index.php/about-us. I can only assume there's an on/off setting. I have PHP 5.6 installed. Quote Link to comment https://forums.phpfreaks.com/topic/298817-indexphprandom-word-here/#findComment-1524296 Share on other sites More sharing options...
scootstah Posted October 26, 2015 Share Posted October 26, 2015 I'm not sure what would have caused them to index those pages to start with. Maybe some other site linked to your site with those pages for some reason. In any case, now that they are indexed, they're likely to remain that way for a while. Are you returning a proper 404 header for those pages? Quote Link to comment https://forums.phpfreaks.com/topic/298817-indexphprandom-word-here/#findComment-1524321 Share on other sites More sharing options...
Gingechilla Posted October 26, 2015 Author Share Posted October 26, 2015 I have a file called index.php and I want to have a file called index.php What I don't want, is for the ability of the public to be able to type domain.com/index.php/what-ever-words-they-want-to-type. At the moment when they go to domain.com/index.php/what-ever-words-they-want-to-type it loads my domain.com/index.php. I'm not sure why this happens. Quote Link to comment https://forums.phpfreaks.com/topic/298817-indexphprandom-word-here/#findComment-1524333 Share on other sites More sharing options...
benanamen Posted October 26, 2015 Share Posted October 26, 2015 (edited) It does that because you have a 404 redirect somewhere. Edited October 26, 2015 by benanamen Quote Link to comment https://forums.phpfreaks.com/topic/298817-indexphprandom-word-here/#findComment-1524337 Share on other sites More sharing options...
scootstah Posted October 26, 2015 Share Posted October 26, 2015 You need to return a 404 header when an invalid page is reached. That doesn't happen automatically, you have to do that from your routing logic. Quote Link to comment https://forums.phpfreaks.com/topic/298817-indexphprandom-word-here/#findComment-1524349 Share on other sites More sharing options...
benanamen Posted October 26, 2015 Share Posted October 26, 2015 Search your code for a header location to index.php header('Location: Also look in .htaccess for an existing redirect If you dont find anything there, the other place would be in the server conf file if you have access it it. You first need to find out where and what your current redirect method is. Quote Link to comment https://forums.phpfreaks.com/topic/298817-indexphprandom-word-here/#findComment-1524369 Share on other sites More sharing options...
Gingechilla Posted October 26, 2015 Author Share Posted October 26, 2015 Hi. Thanks for your help. In the end I canonical link the file to where I wanted it to go. After that I just chose to redirect anyone who tries going to domain.com/index.php/* back to domain.com/ Quote Link to comment https://forums.phpfreaks.com/topic/298817-indexphprandom-word-here/#findComment-1524405 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.