0

I am using AWS to host my website. My domain is pointing to

/root/code/website/

Now i want to put user realted custom CSS to this path

/root/code/resources/ I have tried

<link href="../resources/1111.css">

but its not working. Is there any way to include these css files to my PHP scripts.

2 Answers 2

1

It depends on how you configured your AWS. First of all you need allow permission via nginx, apache to directory outside of your project (/root/code/resources/). Then configured nginx or apache server

Example for Nginx

location ~* \.(css) {
    root /root/code/resources/;
}

and your path will be

  <link href="1111.css">
Sign up to request clarification or add additional context in comments.

Comments

0

If you php file's path is

/root/code/website/index.php

and for CSS

/root/code/resources/custom-styles.css

then <link href="../resources/custom-styles.css"> will work fine, unless this file is not the file which is being served, i.e if this file is getting included in some other file, the path should be w.r.t that file

i.e for file

/root/code/website/dist/index.php

<link href="../../resources/custom-styles.css"> will work.

2 Comments

Its working in all other cases, but here my domain is pointing to /root/code/website/
if you can drop a link to file you're getting error with

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.