How to remove index.php from http://localhost/lvoffc/index.php/login where "lvoofc" is the name of my project.
http://localhost/lvoffc/index.php/login---> Working
http://localhost/lvoffc/login---> Shows "The requested URL
/lvoffc/login was not found on this server."
http://localhost/lvoffc/index.php/register--> Working
http://localhost/lvoffc/register--> Shows "The requested URL
/lvoffc/login was not found on this server."
I have tried the following:
move the index.php and .htaccess from a public to root directory
rename the server.php to index.php and move the .htaccess file to the root directory.
but i'm not successful in removing index.php from the URL
Related
I was able to deploy my laravel 8 application as and addon domain on inmotion shared hosting based on the following article
https://medium.com/backenders-club/how-to-host-a-laravel-project-on-a-shared-hosting-via-cpanel-d955d32c528e
However, there are security issues with this as I can type mysite.com/.env and the file contents is listed in the browser showing the passwords.
I've tried many options to place the public folder of my laravel app into a public_html/public folder and none have worked for me. Anyone also getting this problem?
Addon domain Document root - /public_html/public
Laravel 8 application - /mysite.com (public folder contents moved to public_html/public)
Inside the public_html/public folder, the index.php file modified as follows:
require __DIR__.'/../../mysite.com/vendor/autoload.php';
$app = require_once __DIR__.'/../../mysite.com/bootstrap/app.php';
In browser I get 'No input file specified.'
bad practice if you try to move files inside public folder to root directory , any one can view the files that exist in the root ,
my advice to you ,return your files to the public folder and use one solution from this :-
first , you can make change the domain document root to public path
second you can create .htaccess file in the root folder and contain this code :-
RewriteEngine on
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]
i prefer the first solution.
I uploaded Codeigniter 4 to a shared hosting in a subdirectory.
I can access the installation (the default controller) if I go to http://example.com/ci4/public
but how can I access the default controller if I want to use http://example.com/ci4/
I already added http://example.com/ci4/ in App.php as baseurl. But currenty I'm getting a page not found error.
Try this okay.
I hope it will work
I discovered that when I try to point all my url to public/index.php in my project it return error 404 based on it can't find my controller after rewriting my .htaccess to point to public/index.php in my project root directory.
This is how I solved my problem =>
I move the index.php and the default .htaccess from public directory to my project root directory then I edit the index.php to locate my app directory
E.g
index.php Default find this line
// This is the line that might need to be changed, depending on your folder structure.
$pathsPath = FCPATH . '../app/Config/Paths.php';
Change it to
// This is the line that might need to be changed, depending on your folder structure.
$pathsPath = FCPATH . './app/Config/Paths.php';
I hope this work for you
I want to create '/resources' route in Laravel but there is also directory called 'resources' in laravel so how to handle that ?
currently it is showing resources directory instead of executing route.
First of all, the default resources folder on laravel are in the root directory, not into public directory.
When you access a Laravel URL, eg. http://localhost/xyz, first the server will
search for a xyz file inside public folder, if it exists it will be served, otherwise the index.php will be called and then Laravel try to resolve the route.
solved by public/.htaccess
RewriteCond %{REQUEST_URI} /resources
RewriteRule ^ index.php [L]
I had setup Laravel projects before but this is my first time setting it up on this url format: http://ip-address/~username.
When I first visited the url, it just shows the directory listing so I tried accessing it by appending /public in the url and it works. However all the other links have /public on it and leads to a 404 error.
This is the current directory structure:
inside public_html
- app
- bootstrap
- config
- database
- public
- other folders
- htaccess
- other files
I tried putting an htaccess file in the project root folder.
<IfModule mod_rewrite.c>
Options -Indexes
RewriteEngine On
RewriteRule ^(.*)$ /public/$1 [L]
</IfModule>
However it still doesn't work and I don't know what to do anymore. If you have been in this kind of situation before, please help me. Thank you in advance.
You'll need to set your WebServer's document root to the public directory, that way it looks in the public and you wont have to append your url with public all the time.
Either that or you'll have to move your index.php out of the public directory and put it inside the root directory your web server is currently set as, but I would recommend you do the first option.
I am trying to run my codeigniter website on the server.But I don't have a clue that what settings should I perform.
I find the following link to move the files and do the specified settings but still its not showing me the home page of my website.
Here's what I've done till now.
I moved the codeigniter website's application and system folder on the root directory while my .htaccess file along with my assets and index.php is inside public_html.
Here's my directory structure.
-/home/mysite
-public_html
-index.php <-- the path for system is set to '/home/mysite/system' and for application folder is '/home/mysite/application'
-.htaccess
-system
-application
I've performed the following settings as mentioned in the link.
$config['index_page'] = "";
$config['base_url'] = "http://myurl.com/";
$config['server_root'] = $_SERVER['DOCUMENT_ROOT'];
$config['uri_protocol'] = 'AUTO';
$route['default_controller'] = "home_controller";
Here's my .htaccess file.
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
Now I don't know why my home page is still not appearing when I enter the url to my site.
upload your application folder, system folder, assets folder, index.php, .HTACCESS inside your public_html folder
You need to do few steps:
update 'application/config/config.php' for base_url
update 'htaccess' file for RewriteBase (if needed)
update file permission (if needed)
update 'aplication/config/database.php' for database settings
if still you face issue, then you need to debug like:
print something in index controller and walk through along the function sequence called and then views.