On godaddy
hosting public_html
is given as a web root. I'm trying to install CodeIgniter
on it so I'd like the whole framework to be outside of webroot
(for security reasons). For this specific purpose, in the public_html
directory I've created .htaccess
with the following code:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?example.com$ [NC]
RewriteCond %{REQUEST_URI} !^/sub_webroot/
RewriteRule ^(.*)$ ./sub_webroot/index.php?$1 [L]
Directory/file structure looks like this:
public_html
.htaccess
CodeIgniter (whole framework files except index.php)
sub_webroot
index.php (CI index.php)
assets
sample.png
The framework is loaded successfully and index.php
is removed as well. The problem which I am facing is that I can't open sample.png
via example.com/assets/sample.png
and it is obvious it is happening because of the line RewriteRule ^(.*)$ ./sub_webroot/index.php?$1 [L]
. I can't made up my mind how it would be possible to access the assets
directory and keep the framework working successfully as it is working now. Any ideas how to change .htaccess
that meets my needs ?