2

So I have little bit html on the footer.php and I cannot load the javascript files

Footer.php

        <footer>
            Test
        </footer>
        <script src="./assets/js/jquery-2.2.4.min.js" type="text/javascript"></script>      
        <script src="./assets/js/bootstrap.min.js" type="text/javascript"></script>     
        <script src="./assets/js/npm.js" type="text/javascript"></script>
        <script src="./assets/js/test.js" type="text/javascript"></script>
    </body>
</html>

So when I see on the network on the browser I see the four js files is load like type html.

enter image description here

I used the Eclipse for PHP developers. How can I make the javascript files is load like javascript files not like html files.

When is load is have the mistake for every js file.

SyntaxError: expected expression, got '<'

Edit: Index.php I not have any logic.

Index.php

    <?php 
    include 'views/elements/header.php';
?>

<?php 
    include 'views/elements/footer.php';
?>

In header I don't have any php or html code

EDIT:

I find my problem is in .htaccess. This is my .htaccess file and when I delete then is working.

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUIEST_FILENAME} !-d
    RewriteCond %{REQUIEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

could some one tells me how can make .htaccess to working correct. Or some link from where can I see how to configurate the .htaccess file.

8
  • 1
    You should use htaccess for it to hide the file extensions or change it. Commented Jun 6, 2016 at 8:02
  • show the related php code .. Commented Jun 6, 2016 at 8:03
  • Looks like your web server is sending the wrong header information. The server should send content-type:text/javascript. Have a look at your server configuration. Commented Jun 6, 2016 at 8:05
  • @maxhb I used localhost with xampp. From which file I can check this information? Commented Jun 6, 2016 at 8:07
  • 1
    @evelikov If you hav not changed the xamp setup (which should be ok) then you should look out for a .htaccess file in your current document root. Commented Jun 6, 2016 at 8:22

1 Answer 1

1

Here is the .htaccess i use on my site to redirect all /tds/tre to the index except when called url is a directory or file.

RewriteEngine on
RewriteCond %{REQUEST_URI} !^/index\.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?syst=$1 [QSA,L]
Sign up to request clarification or add additional context in comments.

1 Comment

The reason why yours is not working is. you have miss spelled {REQUIEST_FILENAME} it should be {REQUEST_FILENAME}. Difference between your htaccess and mine. Mine htaccess does also cast the url after the / to the php code with $_GET['syst']

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.