PHP file within a folder

Maybe I need to save a 404page in php too?
The only permissions their is in Godaddy is to direct a custom
404 page that I know of.

Kind of a waste of time since you got rid of the php folder, but ok…

That’s because your 404 calls for relative paths for the css files (so if you were looking for a page in the php file, it would be looking for php/Styles/style.css - or whatever your css file is called). If you want the 404 to work in sub folders, then the style sheet urls need to start with /Styles instead, which tells the browser to look for the css file relative to the root of the site.

No… you just need to set the links appropriately. These (from your 404 page)

    <link rel="stylesheet" type="text/css" href="Styles/404style.css"> 
    <link rel="stylesheet" type="text/css" href="Styles/style.css">
    <link rel="shortcut icon" href="images/favicon_iog.png">

should be

    <link rel="stylesheet" type="text/css" href="/Styles/404style.css"> 
    <link rel="stylesheet" type="text/css" href="/Styles/style.css">
    <link rel="shortcut icon" href="/images/favicon_iog.png">

also

<img src="images/404logo.png" alt="">

should be

<img src="/images/404logo.png" alt="">
1 Like

yeah sorry about that its just that it was not gonna work either way
like I mentioned before I would had basically duplicate my files
(styles, scripts etc) to make it function properly.

wow ok so technically I do not need to have my 404 page in my subfolders just the root
so it can work universally?

wait so are you also saying that in a MAIN root folder everything must start with /
whats is the difference between saying:

/folder/image.jpg
and
folder/image.jpg

As long as you use absolute paths, yes. It’s usually the best way to identify them anyways as you don’t need to calculate where the files are (i.e. not ../ or ../…/)

Technically speaking, the paths are relative to the root, but most developers I know call them absolute paths). True absolute paths include the full address (i.e. http://www.domain.com/style/style.css), but that opens up a whole other can of worms, and doesn’t gain you much in 99.99% of the cases, so relative to the root is just fine.

No…what I’m saying is that in your markup (html, css, javascript) any URLs for static elements (i.e. css, javascript, images) should be linked relative to the root of the site. This ensures the browser will be able to access those assets.

See the links in post #23. If you had those currently, your 404 will work regardless of what folder you’re trying to access.

Let’s use your index.html page as an example. Copy it to a subfolder and access it (example pdf/index,html). It’s broken, right?

But if you do a find/replace to change the following

  1. "Scripts to "/Scripts
  2. "images to "/images
  3. "Styles to "/Styles

And reload it, that page will work regardless of whether you’re in the root or in a sub-folder. This is because the browser is looking for these elements based off the root of the site, not from the current location the file is located in.

3 Likes

The difference is the first is relative to the root of the site, and the second is relative to the location of the file being accessed.

So to go back to index.html.

IF index.html is in the /pdf (i.e. www.domain.com/pdf/index.html) folder, then

  1. /folder/image.jpg should be in /folder/image.jpg (www.domain.com/folder/image.jpg)
  2. folder/image.jpg should be in pdf/folder/image.jpg (www.domain.com/pdf/folder/image.jpg)
1 Like

I see so it is within the change of location of the assets.
to look for the files in the “absolute path”. I think I just found
the solution to the php folder problem I had :sweat_smile:
it was the links that needed to be changed.
oh well… :grin:

Am I correct that impactograph is a subdomain in a folder under iogproducts?

If so, take note that every folder can have its own htaccess file.

1 Like

yes it is a subdomain and ok.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.