Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/138014-need-help-with-switchcase/
Share on other sites

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  

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

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

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.