• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What php variable is the path to the views folder?

#11
Yes I'm using a htaccess file.
When I access a stylesheet in the views folder I get Error 403 Access Forbidden
Reply

#12
(06-23-2017, 05:31 AM)Martin7483 Wrote: How are your

PHP Code:
$config['base_url']
$config['index_page'

setup?

Are you using a htaccess file?
Reply

#13
config.php


Code:
$config['base_url'] = 'http://localhost/ticketclaw';
$config['index_page'] = 'index.php';

.htaccess

Code:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
Reply

#14
When using the htaccess rewrite you should remove the value from

PHP Code:
$config['index_page'] = ''
Reply

#15
I've set it to blank now I'm using .htaccess but I still get Error 403 Forbidden when I try to open a stylesheet.
Reply

#16
Are you using an assets directory that is placed in the root?

application
--config
--controllers
--...
assets
system
index.php
.htaccess
Reply

#17
No it's in the views folder, a stylesheet in the views folder.

application/views/stylesheet.css is forbidden and application/public/stylesheet.css is forbidden
Reply

#18
(06-23-2017, 07:34 AM)desbest Wrote: No it's in the views folder, a stylesheet in the views folder.

application/views/stylesheet.css is forbidden and application/public/stylesheet.css is forbidden

You can not and should not do that.
Direct access to the views folder is blocked by the index.html file that is in the views directory

Normally you keep all your assets in an assets folder.
Then in your htaccess file you add that assets folder to the ignore list on the rewrite
That will prevent any url starting with assets to be routed through the index.php file

Code:
# an ignore list. If any one of these is the the request it will not be routed to the index.php
RewriteCond $1 !^(index\.php|assets|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
Reply

#19
I still can't get it to work. It says error 403 access forbidden.

Code:
<link rel="stylesheet" href="<?=base_url('application/assets/');?>stylesheet.css" type="text/css">
Code:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|assets|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]
Code:
<link rel="stylesheet" href="http://localhost/ticketclaw/application/assets/stylesheet.css" type="text/css">
Reply

#20
Place the assets folder in your root so your link becomes

Code:
<link rel="stylesheet" href="http://localhost/ticketclaw/assets/stylesheet.css" type="text/css">
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


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