Grow your CSS skills. Land your dream job.

htacces & or PHP headache

  • # May 21, 2013 at 4:09 pm

    Hi, i am desperate i know css tricks is front-end oriented but i’m hoping that a code ninja is on the watch, i currently have the code below to redirect all requests (except files) to the index.php unfortunately i cannot get my script to work because of some strange mime type error happening when my url ends with a slash.

    The strange part is that my code output is the same with both urls but the error appears only in the / ending one.

    So i’m looking for a way to redirect all request as it’s working right now just withouth slash or just solve the mime type issue, but i have no idea what is causing it…


    Options +FollowSymlinks
    # Options +SymLinksIfOwnerMatch
    RewriteEngine On

    # Redirect /index.php to / (optional, but recommended I guess)
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9} /.*index.php
    RewriteRule ^index.php/?(.*)$ $1 [R=301,L]

    # Run everything else but real files through index.php
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php/$1?%{QUERY_STRING} [L]

    # May 21, 2013 at 4:28 pm

    Copying your code posted above onto my own server does not produce the problem you are describing. In both cases, index.php is called.

    Can you post the actual error and/or provide a link?

    # May 21, 2013 at 5:55 pm

    Errors:

    Resource interpreted as Stylesheet but transferred with MIME type text/html: “http://localhost/KarimCossutti/lab/css/main.css”. localhost:12
    Resource interpreted as Script but transferred with MIME type text/html: “http://localhost/KarimCossutti/lab/js/plugins.js”. localhost:14
    Resource interpreted as Stylesheet but transferred with MIME type text/html: “http://localhost/KarimCossutti/lab/css/normalize.min.css”. localhost:11
    Resource interpreted as Script but transferred with MIME type text/html: “http://localhost/KarimCossutti/lab/js/main.js”. localhost:14
    Resource interpreted as Script but transferred with MIME type text/html: “http://localhost/KarimCossutti/lab/js/vendor/modernizr-2.6.2.min.js”.

    link:

    http://karimcossutti.com/newsite/lab/

    # May 21, 2013 at 6:50 pm

    Ahh, well that’s easy. You use a relative URL to your stylesheets and js files:

    href=”css/normalize.min.css”

    When the URL ends with a slash, that is included in the URL.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".