I've added the following to my public/.htaccess file in my laravel project.
#### Force lower case URL ####
RewriteCond %{REQUEST_URI} ^[^A-Z]*[A-Z].*
RewriteRule ^ ${lc:%{REQUEST_URI}} [L,R=301]
It works as far as converting all upper-case characters to lower, however it reroutes the url to the public folder.
ie. /jobs gets rerouted to /public/jobs
Is there away to avoid this?
You shouldn't edit or add .htaccess
file, edit index.php
etc. What you should do is point web server to a public
directory instead of root one .
If you're using Apache, edit these lines in a virtual host block:
DocumentRoot "C:/projects/laravel/public"
<Directory "C:/projects/laravel/public">
Restart Apache and everything will work as expected.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.