1) If I'm using mod_rewrite, I can no longer use relative links, right?
2) Is this the best method for hard links:
Code: Select all
$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])Moderator: General Moderators
Code: Select all
$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])You can... but if mod_rewrite simulating folders they're a bit trickier and for practical purposes most people make them absolute by prepending the full web root path.If I'm using mod_rewrite, I can no longer use relative links, right?
It's buggy, since you're missing the HTTP scheme. (URLs will look like http://www.example.com/folder/stuff and will be resolved relatively). dirname($_SERVER['PHP_SELF']) works reasonably well.Is this the best method for hard links:
Slightly. PHP_SELF can be abused into containing XSS-able characters, so make sure you always escape output using htmlentities()Does this pose any security issues?