Jump to content

Custom index.php does not route correctly


Recommended Posts

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

 

Link to comment
Share on other sites

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 by Kian
Link to comment
Share on other sites

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..

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated