Xampp Localhost bug - codeigniter

I inheritted some legacy code(project). I have to put it on localhost. I'm using xampp. When i access it, the localhost return me:
404 Page Not Found The page you requested was not found.
The project was built under codeigniter framework. Any other project works fine on localhost. If I access localhost/test, it works. But when i access this project it gives me the error.
So I'm looking for any tips or hints from you guys. What can I check or what can i do ? I'm, looking forward for answers from you. Thx
.htaccess code :
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
</IfModule>
<IfModule mod_php4.c>
php_value default_charset utf-8
php_flag display_startup_errors off
php_flag display_errors off
php_flag html_errors off
php_value docref_root 0
php_value docref_ext 0
</IfModule>
<IfModule mod_php5.c>
php_value default_charset utf-8
php_flag display_startup_errors off
php_flag display_errors off
php_flag html_errors off
php_value docref_root 0
php_value docref_ext 0
</IfModule>
<IfModule mod_speling.c>
CheckSpelling On
</IfModule>
#SSLVerifyClient require
#SSLRequireSSL
#SSLVerifyDepth 1
#SSLOptions +StdEnvVars

Related

Laravel www to non www not working woth folder redirection

I have setup code in htaccess File. to redirect https://www.website.com/ to https://website.com/ but both link are working as same.
SetEnv PHPRC /home/customer/www/website.com/public_html/php.ini
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
RewriteCond %{HTTP_HOST} ^www.website.com [NC]
RewriteRule ^(.*)$ http://website.com/$1 [L,R=301]
</IfModule>
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
# Disable Directory listing
Options -Indexes
# block files which needs to be hidden, specify .example extension of the file
<Files ~ "\.(env|json|config.js|md|gitignore|gitattributes|lock)$">
Order allow,deny
Deny from all
</Files>
</IfModule>
<IfModule mod_headers.c>
Header set Cache-Control "private"
</IfModule>
AddHandler application/x-httpd-php80 .php .php5 .php4 .php3
Try this
RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
http to https
www to non www

Laravel When Upload POST File, give the 403 error in Apache Web Server

i have VPS Ubuntu Server with Apache and Laravel Controller that upload an file with 100 MB size, and it's using ajax to Send the file.
The problem is when i am testing in my Ubuntu Laptop it's working fine but when i tried in my windows clients it throw 403 code.
Some friends in the cloud suggest to change the ownership and the htaccess setting, and i changed it to www-data user, but it's not resolved the problem.
Here my .htaccess in my (root) Laravel:
LimitRequestBody 2147483647
php_value post_max_size 500M
php_value upload_max_filesize 500M
Options +FollowSymLinks
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
And Here my .htaccess in public folder:
LimitRequestBody 2147483647
php_value post_max_size 500M
php_value upload_max_filesize 500M
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
Is there any problem from my .htaccess?

Laravel .htaccess file is adding /public/ to all my links to external websites

My Laravel .htaccess file is adding /public/ to all my links to external websites, how can I fix that. I have only this in .htaccess:
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
Please help me resolve this
Thank you.
try this on your .htaccess file
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
<FilesMatch "^\.env">
Order allow,deny
Deny from all
</FilesMatch>
Options All -Indexes
<FilesMatch "\.(jpg|jpeg|png)$">
<IfModule mod_headers.c>
Header set Content-Disposition "attachment"
# for older browsers
Header set Content-Type "application/octet-stream"
</IfModule>
</FilesMatch>
# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php72” package as the default “PHP” programming language.
<IfModule mime_module>
AddType application/x-httpd-ea-php72 .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit

CakePHP only works on Mac local when using VirtualHost

I have a CakePHP 2.x app here: /Users/cameron/Sites/ExampleApplication
And inside it has the standard structure:
/app
/webroot
etc.
However when I go to:
localhost/~cameron/ExampleApplication
I get the error: The requested URL /Users/cameron/Sites/ExampleApplication/app/webroot/ was not found on this server.
However if I setup a VirtualHost like:
<Directory "/Users/cameron/Sites">
Header set Access-Control-Allow-Origin "*"
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
<VirtualHost *:80>
DocumentRoot "/Users/cameron/Sites/ExampleApplication"
ServerName example.com
UseCanonicalName Off
</VirtualHost>
It works fine!
Any ideas why it works for the VirtualHost but NOT when accessing it via the usual localhost?
Here is what is inside the three .htaccess files:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>
If you use Mamp, you have to configure the htaccess file
and modify htaccess in folder root / app/webroot and app/config
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteBase / "production" or /nameFolder/ "dev"
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]

CodeIgniter frontend do not work

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>

Resources