Hello @flipmedia
This means that you have the whole project in your document root. To quote a part from the documentation: https://laravel.com/docs/10.x/deployment
Please ensure, like the configuration below, your web server directs all requests to your application's public/index.php file. You should never attempt to move the index.php file to your project's root, as serving the application from the project root will expose many sensitive configuration files to the public Internet:
Depending on the exact config of your server it can be possible to load url's like http://10.50.192.128/ksrtcCareers/.env and get sensitive information.
I tried as per your suggestions . My current .htaccess file in /public folder is
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
I got apache error as
[Thu Nov 02 16:03:15.412009 2023] [core:error] [pid 206214:tid 206403] [client 10.64.241.20:55062] AH00124: Request exceeded the limit of 100 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
Please advise
Hi @flipmedia
It seems like you're trying to remove the "/public/index.php/" part from your Laravel 10 URL. You mentioned that you added an .htaccess
file in the root folder of /var/www/html/ksrtcCareers
with the following content:
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
However, even after adding this file, you're still unable to remove the "/public/index.php/" part from your URL and get a "Not Found" error.
One possible reason for this error could be that the mod_rewrite
module is not enabled on your Apache server. You can enable it by running the following command:
sudo a2enmod rewrite
After enabling the mod_rewrite
module, you need to restart the Apache server for the changes to take effect:
sudo service apache2 restart
Once you've enabled the mod_rewrite
module and restarted the Apache server, try accessing your Laravel app again without the "/public/index.php/" part in the URL. If you're still having trouble, you may need to check your Apache configuration files to ensure that they're properly configured to allow URL rewriting.
I hope this helps!
No Anwar, It's not gave a solution for me . I done all these steps but no positive result.
Hello @flipmedia
Please check this article (https://websolutionstuff.com/post/how-to-remove-index-php-from-url-in-laravel-9)
I hope your concern is resolved.
Happy to help..!!
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community