How to deploy the build of the angular 5 project in Laravel? I am deploying the build files of angular in Laravel, it is working everything fine but when I refresh after routing to any page is showing 404. The reason is it will check the controller in the backend with that URL. I tried to avoid this problem by using hash strategy but I am thinking it is not a good idea. So please help me resolve this issue.
As mentioned in Angular
issue use following .htaccess
file to load the same page of angular on refresh.
<IfModule mod_rewrite.c>
RewriteEngine on
# Don't rewrite files or directories
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
# Rewrite everything else to index.html
RewriteRule ^ index.html [L]
</IfModule>
If your index.html file is not in your root folder then you have to change the path of index.html
as where your index.html
exist,
like my index.html
is in resources/views/
then i will write the rule in .htaccess
as :
RewriteRule ^ resources/views/index.html [L]
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.