My application structure is like:
wamp/www
/project
/app
/public
/system
/writable
I am able to access the application from http://localhost/project/public. However, http://localhost/project shows index of project.
I tried putting .htaccess file in the project folder.
RewriteEngine On
RewriteBase /project/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ public/index.php/$1 [L]
It is also not working.
How do I make the application accessible from the project folder.
Related
Let's say I have a domain www.example.com
Now I want that, at this domain, my index page or main controller of the CodeIgniter folder should open without the folder name and the rest controller pages also without the folder name.
From: www.example.com/folder
To: www.example.com
I am hosting my files on hostinger. I don't want to remove my folder and export all the structure to base public_html.
I want my public_html to contain my CodeIgniter folder.
Any help would be appreciated!
To setup codeigniter on a subdirectory, you could try the following htaccess rule :
Options +FollowSymLinks
RewriteEngine On
RewriteBase /YOUR_SUBFOLDER
RewriteRule ^$ index.php [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond $1 !^(index\.php|robots\.txt|favicon\.ico)
RewriteRule ^(.*)$ index.php?/$1 [L]
Change the YOUR_SUBFOLDER above to whatever subdirectory name you have.
I have tried almost all the solutions on internet regarding this issue.
I have moved my Laravel project from Windows 10 to linux CentOS 6. I tried to change project structure in two different manner but both face the issue.
I am trying to remove index.php from [www.example.com]/index.php/[routes url]. I don't have access to root or sudo command as this project is being installed in University server. But I can request IT admin for tasks that require root access.
I am currently in /home/cs4/username (folder). My current project structure is:
blog (folder)
- contains all the Laravel framework files other than public folder
public_html (folder)
- contains all the files of laravel public folder plus
- .htaccess file created
.htaccces file contains below code:
# Redirect Trailing Slashes...
#RewriteRule ^(.*)/$ $1 [L,R=301]
RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
RewriteCond %{REQUEST_URI} !/system/.* [NC]
RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
#RewriteRule ^ index.php [L]
RewriteRule ^(.*)$ /index.php/$1 [L]
I have replaced 2 lines of index.php file which is in public_html folder
from these
require __DIR__.'/../bootstrap/autoload.php';
$app = require_once __DIR__.'/../bootstrap/app.php';
to
require __DIR__.'/../blog/bootstrap/autoload.php';
$app = require_once __DIR__.'/../blog/bootstrap/app.php';
Issue is that http://example.ac.uk/~username/ loads the project but for all other url's I have to add index.php for example: http://www.example.ac.uk/~username/index.php/login instead of http://www.example.ac.uk/~username/login similarly for all other url's.
I also tried to put entire project inside public_html folder, the directory structure was:
public_html
-entire project files and folders
-public folder
but then 2 issues:
all the server files like : .env and other code is exposed causing security risk
I am forced to have public/index.php in the url.
for example: http://www.example.ac.uk/~username/public/index.php/login instead of http://www.example.ac.uk/~username/login similarly for all other url's.
I am getting following error after opening the codeigniter base url:
"No Input file specified". I know that it has something to do with htaccess file but can't make it work.
my htaccess file content:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
Go daddy directory structure: htaccess file is at root folder of subdomain.
Your htaccess file is fine you need to check paths in controller
i guess it could be view file missing
$this->load->view('file_view', $data);
in views folder it is named "file_view.php"
also make sure file paths are correct
if you are calling a module module file exists under modules folder
check $route['default_controller'] = "frontpage"; in routs.php under config folder for above line frontpage.php must exist in views folder
add rewrite base
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
I have a question, where should I put framework folders on live server? That's my first application in Zend Framework 2. On localhost everything seems to work fine, I wanted test it on live server and I got confused.
home
home/username
home/username/public_html
I put everything in public_html with copied .htaccess from Zend's public folder. So my structure looks like this:
home/
home/username/
home/username/public_html/
config/
data/
module/
public/
vendor/
.htaccess
init_autoloader.php
But I can't access my application in www.mydomain.com/ I have to use www.mydomain.com/public
I think the problem is with .htaccess, so here it is:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteCond %{REQUEST_URI}::$1 ^(/.+)(.+)::\2$
RewriteRule ^(.*) - [E=BASE:%1]
RewriteRule ^(.*)$ %{ENV:BASE}index.php [NC,L]
php_flag eaccelerator.enable 0
php_flag eaccelerator.optimizer 0
I tried add RewriteRule ^(.*)$ /public/index.php [NC,L] but it didn't change anything.
Is it a proper structure of application on live server?
Where should I keep vendor folder?
I usually clone my application to /home/username/application and symlink /home/username/public_html to application/public
Your location of the vendor folder is fine!
Is it possible to redirect image files to directory outside of root directory?
Directory structure
wamp\www\site\images\image.jpg
Redirect to
wamp\www\images\image.jpg
Using .htaccess something like.
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^images/(.*)$ ../images/$1
Also if this can be done by any other means that will be good as well.