CodeIgniter frontend do not work - codeigniter

I bought a real estate cms written with CodeIgniter, i uploaded it to my hosting account, but when i try to access my url it doesn't show the frontend part.
I know there is a problem in url rewrite or something like this, if someone can help me, i'll be thankful
By the way the backend work as well (immonador.esy.es/admin/index.php) but the frontend (immonador.esy.es/index.php) dosen't work. This is my .htaccess file
<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
RewriteBase /
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>
<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>

Try this
<IfModule mod_rewrite.c>
RewriteEngine on
Options +FollowSymLinks
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
RewriteBase /
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>
<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>

Related

How to remove 'public' from Laravel URL?

I have a default laravel 8 project. I can only access my files if i use '/public/' to acess the route,and i do NOT want that. i just want to go 'localhost/ProjectName/Route' and not 'localhost/ProjectName/public/Route'.
I have tried changing .htacess, sending it to root,renaming server.php to index.php and a million other solutions i have found on the web.
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization MemberHeader
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Remove public URL from the path
RewriteCond %{REQUEST_URI} !^/public/
RewriteRule ^(.*)$ /public/$1 [L,QSA]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
<IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
this is my htacess
Make sure your webs server configuration has the public directory set as the root folder rather than the root folder of the Laravel project.
Replace your .htaccess file with following code. Please note, you don’t need to rename server.php to index.php or anything to remove /public name. Just using following code in your .htaccess file and you are good to go.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
Result:
website.com/public/route to website.com/route
If you are trying to run laravel project in sub-folder within the root directory, above code won't work. Instead, use following code in your .htaccess file.
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ ^$1 [N]
RewriteCond %{REQUEST_URI} (\.\w+$) [NC]
RewriteRule ^(.*)$ public/$1
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ server.php
</IfModule>
Result: website.com/sub-project/public/route to website.com/sub-project/route

When i use index.php/User/login its working, But when i use User.login its not working even after removing of index.php in codeigniter

When i use
index.php/User/login its working, But when i use User/login its not working even after removing of index.php in codeigniter, can anyone say what is wrong with my code? its on live server of root directory
my htaccess file is
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
# Hide the application and system directories by redirecting the request to index.php
RewriteRule ^(application|system|\.svn) index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [QSA,L]
</IfModule>
Please try below code
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
I've been using this code for many years. I think it could work for you.

/public still appears in some URLs but not others after updating .htaccess file

I've updated my .htaccess in public_html root directory to try to remove /public from the URL
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
It works for some URLs but not others. I've cleared server & browser cache. Still no improvement.
I'm working with Laravel 5.7, PHP 7
Any help appreciated. If more info needed let me know and I'll do my best to provide it.
Cheers
Edit your .htaccess with this code. it might help
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ ^$1 [N]
RewriteCond %{REQUEST_URI} (\.\w+$) [NC]
RewriteRule ^(.*)$ public/$1
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ server.php
</IfModule>

.htacces for api rest and admin panel

I have a website in laravel with this .htacces and work fine for my admin panel
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
but now I wrote an APP in Ionic that consume an api rest from my website and I cant access the server but if change the .htaccess to this, work for the APP but not the website
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]
</IfModule>
My error is “CAUTION: provisional headers are shown” and headers are not sent if I use the first .htacess.
I would like to know how to combine the two .htaccess, I tried this but doesn't work.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]
</IfModule>

Issue of hosting on godaddy for CodeIgniter 3?

I have an issue with godaddy hosting my site using CodeIgniter 3, its working for main homepage, but when I clicked on links it need like www.example.com/index.php/submodule/subdir,
I don't understand how can I solve it and use it like www.example.com/sumodule/subdir
I'm using this HTACCESS file
<IfModule mod_rewrite.c>
Options +FollowSymLinks
Options -Indexes
DirectoryIndex index.php
RewriteEngine on
RewriteCond $l !^(index\.php|images|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$l [L,QSA]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>
Use this in .htaccess file and .htaccess file must be outside codeigniter application folder
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) /index.php?/$1

Resources