dongyou8701 2015-07-02 07:26
浏览 44

Laravel 5路由使用服务器

I installed Laravel 5 on a ftp server. Everything is fine, the main page is enable. But I have a problem with my routes. A link is calling a route which is calling a controller which is returning a view.

My link :

<div class="logo"><a href="{{ route('accueil') }}"><img src="images/logo.png" alt=""></a></div>

My route :

Route::get('/', [
'as' => 'accueil',
'uses' => 'ControllerTest@accueil']);

My controller :

class ControllerTest extends Controller
{
    public function accueil()
    {
        return view('accueil');
    }

}

But when I look to my element, I can see this : href="http://XX.XXX.XX.XXXC:/test/public/index.php" instead of href="http://XX.XXX.XX.XXX/test/public/index.php"

It seems like Laravel is mixing the server's IP and the localhost. I can't find what's wrong. I searched online a solution, but I always have this issue.

There is my .htaccess file in /public folder

<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
    Options -MultiViews
</IfModule>

RewriteEngine On
RewriteBase /test

# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]

# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ /index.php [L]

And there is my httpd.conf file used by apache.

<VirtualHost *:80>
  DocumentRoot C:/htdocs
  RewriteEngine On
  RewriteOptions Inherit 
  <Directory "C:/htdocs">
    AllowOverride All
    Order allow,deny
    Allow from all
    Require all granted
  </Directory>
</VirtualHost>

And, I have enable the rewrite_module in the same file (httpd.conf) like this :

LoadModule rewrite_module modules/mod_rewrite.so

I don't understand why it can't work. If someone has an idea to help me.

Thanks for reading.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
    • ¥15 如何处理复杂数据表格的除法运算
    • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
    • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
    • ¥200 uniapp长期运行卡死问题解决
    • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
    • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?
    • ¥15 乘性高斯噪声在深度学习网络中的应用
    • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
    • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集