1

I searched but did not find a definitive answer for my question.

What is the best practice to include .css, .js, and other files? How do I declare it in my configuration file. I tried :

define('CONST_ADMIN_JAVASCRIPT_LOCATION', 'jscript/');

This works but i think is most elegant to define like this in index.php:

define( 'ADMIN_ROOT', realpath(dirname(__FILE__))); 

And then the css directory :

define('CONST_ADMIN_CSS_LOCATION', ADMIN_ROOT.'templates/default/css/');

So if i try this then when including css, js, and other files then I get an error : 404 Not Found

<link href="/var/www/html/mysite/adminarea/templates/default/css/default_admin.css.php "    rel="stylesheet" type="text/css">

The file is there so I'm thinking the .htaccess file restriction must be the problem.

This is my .htaccess file:

RewriteEngine on
# HTTP OVER SSL
#RewriteCond %{HTTPS} !on
#RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# Redirect non-www to www
#RewriteCond %{HTTP_HOST} !^www\.
#RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

# Restricting direcotry listings
Options -Indexes

## RESTRICTING UPLOADS ONLY FOR IMAGE FILES
<Files ^(*.jpeg|*.jpg|*.png|*.gif)>
order deny,allow
deny from all
</Files>

So what is the best practice solution for this problem ?

4

0

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.