简体   繁体   中英

error Code 404 not found when run project from root from public run normal

In my issue when i am try to call any route from subdomain root return laravel error 404 not Found however when i am try to run project from subfolder /public inside project run normal and route call normal

for example: when i am call url: www.example.com/myprojectroot Return: 404 not found like screenshot enter image description here

But when i am call any route from url: www.example.com/myprojectroot/public/anydefine route in this case route call normal but some assest not working

so that i need to call any route from main root not from subfolder public how can i do that

and this my .htaccess code on subdomain root

`

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_URI} !^public
    RewriteRule ^(.*)$ public/$1 [L]
</IfModule>

I AM TRY TO CHANGE ON .HTACCESS BUT RETURN 403 FORBIDDEN

I think you are using Apache. Try to add this to its configuration (Usually its here /etc/httpd/conf/httpd. conf)

<Directory /var/www/yourproject/> 
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

And you also need to enable pretty urls (I think your laravel version is old) https://laravel.com/docs/5.0/configuration#pretty-urls

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM