I need to use a file name other than index.php

ClassiBase classifieds script Forums General help I need to use a file name other than index.php

Tagged: ,

This topic contains 5 replies, has 2 voices, and was last updated by  ClassiBase 3 years, 4 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #525 Reply

    rakesh nair
    Participant

    The domain that i m using for the classified site has been earlier used by an adnetwork, so there are still java script tags left on many of the websites which are trying to pull data from index.php file causing he server to crash.

    I need a solution where i can use any other file name other than index.php i think this could solve the problem

    #528 Reply

    ClassiBase
    Keymaster

    Renaming index.php to any other filename like index2.php will not reduce load on your site because if visitor goes to yourdomain.com/index.php it will load site’s homepage, it will not give 404 error page. So yourdomain.com/index.php is same as yourdomain.com/ will load homepage of your site.

    To restrict direct access to index.php use following snippet at the top of your sys/config.php file on line 2 just after opening php tag.

    // restrict direct access to index.php
    list($req_script, ) = explode('?', $_SERVER['REQUEST_URI']);
    list(, $req_script_last) = explode('/', trim($req_script, '/'));
    if($req_script_last == 'index.php')
    {
    	header('HTTP/1.0 404 Not Found');
    	exit('index.php direct request formidden');
    }

    We suggest using this snippet on config file because on script update sys/config.php file will stay unchanged. Where index.php will be replaced with new version.

    #533 Reply

    rakesh nair
    Participant

    seems like this solution is not working, the server crashed again. Can we do anything with .htaccess file, i mean something like stopping the hotlinking of javascript

    #534 Reply

    rakesh nair
    Participant

    exit('index.php direct request formidden');

    the above code that you gave, is there a typo in it, should it be forbidden instead of formidden ?

    could it be that the code is not working because of that?

    #535 Reply

    rakesh nair
    Participant

    have been waiting for a reply for a while, will you be able to help me in this, is there any way you can help me then do let me know at the earliest.

    should i give you my hosting details, so that you can get a better picture

    #536 Reply

    ClassiBase
    Keymaster

    no that typo will not effect the code. it should work. what happens when you visit your site with yourdomain.com/index.php ?

    it should display that “index.php direct request formidden” message on empty page. if it is not displaying it then you have not inserted snipped correctly. if that is the case send your server details via contact form so we can take a closer look at it.

    regards.

Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: I need to use a file name other than index.php
Your information: