Chud37 Posted March 27, 2012 Share Posted March 27, 2012 I have recently discovered the mod_rewrite, and so now i've got rewrite settings on my server where by it will not map /series/english/myseries to index.php?q=english&series=myseries; Which is all very well and good and works nicely. However, When I am trying to load say a Javascript file inside Index.php now, or include a PHP file, I have huge problems, because it is trying to look at my 'relative' path of 'js/jquery.js' and cant find it from the pseudo directory 'series/english/myseries'. What is the best way to compensate for this problem? For the PHP includes i've started using $_SERVER['DOCUMENT_ROOT']; which seems to map files okay. But i can't do the same with JS. I dont know what to do Quote Link to comment https://forums.phpfreaks.com/topic/259811-problems-with-apace-mod_rewrite/ Share on other sites More sharing options...
requinix Posted March 27, 2012 Share Posted March 27, 2012 You can: prepend all your paths with /. $_SERVER["DOCUMENT_ROOT"] is an absolute path to the root of your website... on the server. / is an absolute path to the root of your website... on the client. Quote Link to comment https://forums.phpfreaks.com/topic/259811-problems-with-apace-mod_rewrite/#findComment-1331581 Share on other sites More sharing options...
Chud37 Posted March 27, 2012 Author Share Posted March 27, 2012 So does that mean for client side file references (i.e. javascript includes etc) I can use a '/' and for the server side - I can use $_SERVER['DOCUMENT_ROOT']? Quote Link to comment https://forums.phpfreaks.com/topic/259811-problems-with-apace-mod_rewrite/#findComment-1331582 Share on other sites More sharing options...
requinix Posted March 27, 2012 Share Posted March 27, 2012 Yes. Quote Link to comment https://forums.phpfreaks.com/topic/259811-problems-with-apace-mod_rewrite/#findComment-1331619 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.