最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - net::ERR_ABORTED 403 (Forbidden) error in codeigniter when using store locator - Stack Overflow

programmeradmin2浏览0评论

I am new to codeigniter and i am facing some issue. I have created a store locator by using core php.It's working perfectly.But i want to embed the code in codeigniter.I copied the files and when i try to run it's not displaying and showing following errors in console.

GET http://xxx/application/views/webpages/storeLocator/storelocator.js net::ERR_ABORTED 403 (Forbidden)

GET http://xxx/application/views/webpages/libs/handlebars.min.js net::ERR_ABORTED 403 (Forbidden)

For your reference: i have taken the code from /

I added the following script path in header.php

<script src="<?php echo base_url();?>application/views/webpages/libs/handlebars.min.js"></script>
<script src=";></script>
<script src="<?= base_url();?>application/views/webpages/storeLocator/storelocator.js"></script>```

NB:base_url is correct, because it's working for others.Anyone please help me . I tried different things last couple of days. 




  

I am new to codeigniter and i am facing some issue. I have created a store locator by using core php.It's working perfectly.But i want to embed the code in codeigniter.I copied the files and when i try to run it's not displaying and showing following errors in console.

GET http://xxx/application/views/webpages/storeLocator/storelocator.js net::ERR_ABORTED 403 (Forbidden)

GET http://xxx/application/views/webpages/libs/handlebars.min.js net::ERR_ABORTED 403 (Forbidden)

For your reference: i have taken the code from https://www.softaox.info/jquery-store-locator-google-map-with-country-state-city-dropdown/

I added the following script path in header.php

<script src="<?php echo base_url();?>application/views/webpages/libs/handlebars.min.js"></script>
<script src="https://maps.google./maps/api/js?key=xxxxx"></script>
<script src="<?= base_url();?>application/views/webpages/storeLocator/storelocator.js"></script>```

NB:base_url is correct, because it's working for others.Anyone please help me . I tried different things last couple of days. 




  
Share Improve this question edited Oct 30, 2020 at 5:38 ajo asked Oct 30, 2020 at 4:54 ajoajo 151 gold badge2 silver badges7 bronze badges 2
  • Might be permissions on that file, try and change the chmod and check chown too. – marcogmonteiro Commented Oct 30, 2020 at 9:12
  • 1 No not working.Is there any way to redirect it to act like normal php codes?(like third party) @marcogmonteiro – ajo Commented Oct 30, 2020 at 10:31
Add a ment  | 

1 Answer 1

Reset to default 0

You are storing your javascript inside your views folder. The views folder should only have your view files.

For assets like images, css and javascript you should create a folder in your root directory like public with the following structure:

application
system
public 
   - css
   - js 
   - img

Then in your views you load your javascript files with base url like this:

<script src="<?php echo base_url('public/js/libs/handlebars.min.js') ?>"></script>

All your files inside your application folder shouldn't be directly accessible. You only access your index.php outside said folder and let it do its magic.

Public files should be outside the application and system folders. Always.

发布评论

评论列表(0)

  1. 暂无评论