gaza165 Posted December 22, 2008 Share Posted December 22, 2008 I have a switch/case page included in my index.php to load all the different pages of the site from one page based on the url so like this. www.domain.com?case=showblog www.domain.com?case=default i am also using mod_rewrite to make the urls prettier www.domain.com/showblog the problem i am having is with the navigation. if my a href is index.php that should take me to the home page. however, if im on www.domain.com/showblog, it shows the page correctly but the navigation is wrong as it tries to find.... showblog/index.php and doesnt go back to the root index.php can anyone help?? Quote Link to comment https://forums.phpfreaks.com/topic/138014-need-help-with-switchcase/ Share on other sites More sharing options...
JasonLewis Posted December 22, 2008 Share Posted December 22, 2008 Use absolute linking, not relative. That's my only suggestion. You can also look at HTML's <base> tag. Quote Link to comment https://forums.phpfreaks.com/topic/138014-need-help-with-switchcase/#findComment-721316 Share on other sites More sharing options...
gaza165 Posted December 22, 2008 Author Share Posted December 22, 2008 is there anywhere in my .htaccess where i can specify the base for links? Quote Link to comment https://forums.phpfreaks.com/topic/138014-need-help-with-switchcase/#findComment-721325 Share on other sites More sharing options...
JasonLewis Posted December 22, 2008 Share Posted December 22, 2008 Not sure, the <base> tag does though. http://www.w3schools.com/TAGS/tag_base.asp Quote Link to comment https://forums.phpfreaks.com/topic/138014-need-help-with-switchcase/#findComment-721328 Share on other sites More sharing options...
gaza165 Posted December 22, 2008 Author Share Posted December 22, 2008 is there any reason why my css is not showing.. it seems to be referencing the file wrong.. this is my htaccess file. Options -Indexes RewriteEngine On RewriteRule ^([_\+A-Za-z0-9]+)/([_\+A-Za-z0-9]+)?$ index.php?c=$1&title=$2 Quote Link to comment https://forums.phpfreaks.com/topic/138014-need-help-with-switchcase/#findComment-721337 Share on other sites More sharing options...
premiso Posted December 22, 2008 Share Posted December 22, 2008 is there any reason why my css is not showing.. it seems to be referencing the file wrong.. this is my htaccess file. Options -Indexes RewriteEngine On RewriteRule ^([_\+A-Za-z0-9]+)/([_\+A-Za-z0-9]+)?$ index.php?c=$1&title=$2 Look at what ProjectFear wrote. Use the Absolute Paths not Relative. If you want it to still be dynamic, $siteURL = "http://" . $_SERVER['HTTP_HOST'] . "/"; gives you the full path to the initial folder and use that instead of ../ it would be echo '<link href="' . $siteURL . 'css/style.css" />'; Or you can place the $siteURL in the base HTML tag path and remove any ../ in the code. An absolute path Quote Link to comment https://forums.phpfreaks.com/topic/138014-need-help-with-switchcase/#findComment-721485 Share on other sites More sharing options...
Mark Baker Posted December 22, 2008 Share Posted December 22, 2008 is there any reason why my css is not showing.. it seems to be referencing the file wrong.. Is the rewrite rule redirecting the request for the css file to index.php as well? Quote Link to comment https://forums.phpfreaks.com/topic/138014-need-help-with-switchcase/#findComment-721523 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.