Web Analytics Made Easy -
StatCounter using ForceType for friendly urls is breaking relative paths! - CodingForum


No announcement yet.

using ForceType for friendly urls is breaking relative paths!

  • Filter
  • Time
  • Show
Clear All
new posts

  • using ForceType for friendly urls is breaking relative paths!

    hey yall -- so I was for a while just using netdrive to work on websites on a test remote server (netdrive makes a FTP drive act as a local directory), however it's getting a bit hard to manage having to do it this way so I've set up local versions of everything (as I should have from the start!) and am running into an issue.

    So I am using xampp, and currently have friendly urls implemented using forcetype directive in .htaccess:
    <Files ~ "creations">
    ForceType application/x-httpd-php
    The directory stucture is like this:

    htdocs/site1/creations [file used for friendlyurls]

    header.php basically displays the top logo and navbar:
    <a href="index.php"><img src="images/logo.png"></a>
    <li><a href="creations/category1">Category 1</a></li>
    <li><a href="creations/category2">Category 2</a></li>
    <li><a href="creations/category3">Category 3</a></li>
    and of course, both index.php and creations have a <?php include('header.php'); ?> as their first line....

    here's where the problem occurs...

    When viewing http://localhost/site1/index.php, everything works fine -- the logo loads fine, and all the URLs work as expected. However, when viewing "http://localhost/site1/creations" everything breaks :-\.

    The logo image does not appear, and when (in firefox) I right-click it and "copy image location", it shows that it is trying to load "http://localhost/site1/creations/images/logo.png" but it should be trying to load "http://localhost/site1/images/logo.png".

    Also, if I do a <?php echo realpath("images/logo.png"); ?> on either page (index.php AND creations), it echos the correct path without "creations" in it!!

    any suggestions? (on the live site, I have root "/" based paths, as opposed to relative paths, so everything works -- but I can't get root based paths to work locally w/xampp, even when setting up local subdomains [because as I understand it, using "/" means it's trying to start at the root of my drive, C:/, etc etc so it wont' work...)

    thanks for any help!!