简体   繁体   中英

How to remove public from URL in laravel 4.2

The code of my .htaccess file is shown below.It is placed in my laravel project root directory.

<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>

</IfModule>

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>

Using this when I run the url " http://localhost/laravelapi/ " I am getting folder structure. But when I run " http://localhost/laravelapi/public " I am getting the result page. What will be the problem? Please help me to find a solution..

我已经将.htaccess文件从/ public目录复制到了我的Laravel根文件夹中,并且将我的Laravel根文件夹中的server.php重命名为index.php,它对我有用。

Copy .htaccess file from public folder to your Laravel root folder and copy the server.php in the same folder as index.php . That'll do

将公用文件夹添加到项目的根文件夹并运行“ php artisan serve”命令以运行您的项目

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