php - How is a / on the end of my url affecting css file inclusion?

678

I'm new to this, but this week succeeded with nice code that works with"/?page=2" and stuff for a$_GET[].

For speed and ease I'd been calling my fileindex.php so the url was eithertestdomain ortestdomain/ ortestdomain/?page=2.

Today I changed my filename tomulti.php. Now, if anything follows that in the URL, I get an error

"The stylesheet 'http://testdomain/multi.php/mystyle.css' was not loaded because its MIME type, "text/html", is not "text/css".

So URLtestdomain/multi.php works perfectly,testdomain/multi.php/ does not. I've tried as many recommendations about that error as I can find.

945

Answer

Solution:

The '/' character is used in a string like that to symbolize a directory. Your code is looking at the filemulti.php but treating it as if it is a directory.

If your file is located in testdomain then do the following:

http://testdomain/mystyle.css

The.php is indicating that that item is a file not a directory. You may however actually have amulti directory in which case you would access it like the following:

http://testdomain/multi/mystyle.css

Double check your file structure to verify that you have the correct path.

Hope this helps.

People are also looking for solutions to the problem: Questions about .jar files and running a java program through PHP

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.