1

I am currently working on developing a simple framework for a site I am working on, and I was wondering what the best practices for linking would be?

At the moment I am using a global variable to define the links. ie:

$GLOBALS['config'] = array(
'addr' => 'http://localhost/project1/'
);

Obviously depending on where the api is implemented, you have to manually change this in the configs, but I was wondering if there is an easier way?

I have read that there can be potential client side related security issues when using $_SERVER["SERVER_NAME"] and $_SERVER["REQUEST_URI"].

So i guess my question is essentially what would be the best practice be for linking to static pages such as an about page that doesn't require the global variable to be modified every time the api is implemented.

5
  • Can't you just use relative urls?
    – user557846
    Jun 13, 2015 at 0:36
  • Why don't you use an existing framework? It will take care of security and best practices for you (and more) ! Jun 13, 2015 at 0:37
  • 1
    @François I am building my own partially for fun, and partially for the customization. I have enjoyed the process thus far.
    – Pyro4816
    Jun 13, 2015 at 0:43
  • @Dagon I tried relative ?URL's, but they seem to get busted up with my htaccess routing.
    – Pyro4816
    Jun 13, 2015 at 0:47
  • would need more information to help on that
    – user557846
    Jun 13, 2015 at 3:26

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.