• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Load css and js along with htaccess

#1
I'm using htaccess to remove index.php in url, and securing the directories. However, now I can't load css and js in view.

Is there any solution for adding both without changing the htaccess method? (securing index.php)
Reply

#2
Explain where you are keeping the js and css. Also show code on how you try to load those assets. Might be good to share your .htaccess too.
Reply

#3
(06-12-2018, 01:02 PM)dave friend Wrote: Explain where you are keeping the js and css. Also show code on how you try to load those assets. Might be good to share your .htaccess too.

Code:
DirectoryIndex index.php
RewriteEngine On

RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^ index.php [L]

RewriteRule !^(public/|index\.php) [NC,F]

Just now, I found a (temporary) solution.
It's using file_get_contents() to get the content of the file as a string, then return the value (using echo) through controller, which can be accessed by url (like how a function in controller is called).

My next question is, is the method safe? (since the only scripts accessible to users are css and js scripts)
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2018 MyBB Group.