tkalfaoglu Posted July 9, 2018 Share Posted July 9, 2018 Hi. I wrote a custom index.php that decides upon the person's country and shows the correct language depending on the settings.. I renamed the original index.php as index1.php.. then wrote my own index.php.. however, the following code that used to work on the old whmcs now fails to work.. header('Location: http://www.kalfaoglu.net/index1.php?currency=4&language=english'); It now gives a "404" instead.. any ideas how to fix this for the newer whmcs? Many thanks, -tk 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted July 10, 2018 Share Posted July 10, 2018 (edited) I suppose that in the original index file (index1 in your case) there's a script that checks for current file name. If it isn't exactly index.php it throws the error your see. As far as I know it works in this way on all versions of WHMCS 7. That said, it's cool that you managed to automatically set the language of WHMCS based on GeoIP but you should change your approach. The default index file of WHMCS is used by legacy and 3rd-party modules to output clientarea pages. You should move your script from index to an action hook (recommended) or in configuration.php. In this way it will work even better since you can set the right language from any page of WHMCS and not just from index. Edited July 10, 2018 by Kian 0 Quote Link to comment Share on other sites More sharing options...
WHMCS Technical Analyst II WHMCS Lawrence Posted July 11, 2018 WHMCS Technical Analyst II Share Posted July 11, 2018 Hello, Replacing a core file like index.php is not recommended, nor supported, and will cause this issue. As Kian said above, the best way to implement your changes would be as a hook in the /includes/hooks folder: https://developers.whmcs.com/hooks/ 0 Quote Link to comment Share on other sites More sharing options...
tkalfaoglu Posted July 13, 2018 Author Share Posted July 13, 2018 On 7/11/2018 at 10:35 PM, WHMCS Lawrence said: Hello, Replacing a core file like index.php is not recommended, nor supported, and will cause this issue. As Kian said above, the best way to implement your changes would be as a hook in the /includes/hooks folder: https://developers.whmcs.com/hooks/ Thank you. This was working fine until the last versions of WHMCS. I will look into the hooks.. 0 Quote Link to comment 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.