laravel 4 GoDaddy的共享主机路由 [英] laravel 4 godaddy shared hosting routing

查看:306
本文介绍了laravel 4 GoDaddy的共享主机路由的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

抱歉地问你同样的问题,因为我做了一些变化,这个问题仍然持续。

部署了我的GoDaddy的laravel 4项目共同主办。

- 根>我有2个目录 myproject的的public_html

- >在 myproject的文件夹中,我有不同的公共文件夹中的所有laravel应用程序文件

- >我从laravel删除公用文件夹的文件保存在的public_html

然后我根据目录结构做了一些改变...


- >中的public_html / index.php文件

 要求__DIR __'/ .. / MyProject的/引导/ autoload.php。

$应用= require_once __DIR __'/ .. / MyProject的/引导/ start.php。

$ APP->运行();
 


- >及的myproject /引导/ path.php

 '公共'=> __DIR __。'/ .. / .. /的public_html
 


当我进入 mydomain.in ...它的工作,但如果我去的 mydomain.in/products 它不工作,并显示 404页不发现错误

如果我这样做,首先进入 mdomain.in/index.php 它的工作,但在URL地址栏看冗长。 mydomain.in/public_html/index.php/products

有谁能够告诉我可能是什么问题?

和中的.htaccess present中的public_html的code /是:

 < IfModule mod_rewrite.c>
    < IfModule mod_negotiation.c>
        选项​​-MultiViews
    < / IfModule>

    RewriteEngine叙述上

    #重定向结尾的斜杠...
    重写规则^(。*)/ $ / $ 1 [L,R = 301]

    #拉手前端控制器...
    的RewriteCond%{} REQUEST_FILENAME!-d
    的RewriteCond%{} REQUEST_FILENAME!-f
    重写规则^的index.php [L]
< / IfModule>
 

解决方案

我的网站是现在的工作,我想告诉你一些你可能需要的最重要的事情谁使用GoDaddy的共享主机窗口。

谁是那些使用GoDaddy的共享主机的窗户则有西港岛线是的mod_rewrite 的问题,因为的.htaccess 在godaddy的窗户不工作,在godaddy的窗口的Web服务器使用< STRONG> IIS 不是阿帕奇

所以,如果有一个人GoDaddy的共享主机窗口应该使用 Web.config中 而不是的.htaccess 在他们的根。

只需创建一个文件名的 Web.config中,然后插入此code:

 &LT; XML版本=1.0编码=UTF-8&GT?;
&lt;结构&GT;
    &LT; system.webServer&GT;
        &LT;改写&GT;
            &LT;规则&GT;
                &LT;规则名称=指数&GT;
                    &LT;匹配URL =^ $(*)/&GT;
                    &LT;条件&gt;
                        &LT;添加输入={} REQUEST_FILENAMEmatchType =ISFILE否定=真/&GT;
                        &LT;添加输入={} REQUEST_FILENAMEmatchType =IsDirectory否定=真/&GT;
                    &所述; /条件&gt;
                    &lt;作用TYPE =重写URL =的index.php/&GT;
                &LT; /规则&GT;
            &LT; /规则&GT;
        &LT; /重写&GT;
    &LT; /system.webServer>
&LT; /结构&gt;
 

和把这个文件在你的网站的根目录下(无论公用文件夹你要来点)。希望这将是谁使用GoDaddy的窗户的人有帮助。

sorry to ask you the same question because i did some changes and that problem is still persisting.

Deployed my laravel 4 project on godaddy shared hosting.

->in root i have 2 directories myproject and public_html

->in myproject folder i have all laravel app files except public folder

->the public folder files i have removed from laravel kept in public_html

Then i did some changes according to the directory structure...


-> in public_html/index.php

require __DIR__.'/../myproject/bootstrap/autoload.php';

$app = require_once __DIR__.'/../myproject/bootstrap/start.php';

$app->run();


-> and in myproject/bootstrap/path.php

'public' => __DIR__.'/../../public_html'


when i enter the mydomain.in ...its working but if i go to mydomain.in/products its not working and showing 404 page not found error.

If i do the same by first entering mdomain.in/index.php its working but the url in address bar looking lengthy. mydomain.in/public_html/index.php/products

can anybody tell me what could be the problem??

and the code of .htaccess present in public_html/ is:

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

    RewriteEngine On

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

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

解决方案

My website is working now and i would like to tell you the important thing some of you may need who are using godaddy shared hosting windows.

Those who are using godaddy shared hosting windows then there wil be a mod_rewrite problem because .htaccess does not work in godaddy windows as the web server in godaddy windows uses IIS not apache.

So if someone having godaddy shared hosting windows should use Web.Config instead of .htaccess in their root.

just create a file name Web.Config and insert this code:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="Index">
                    <match url="^(.*)$" />
                    <conditions>
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="index.php" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

and put this file in the root of your website (whatever the public folder you are going to point). Hope this will be helpful for people who are using godaddy windows.

这篇关于laravel 4 GoDaddy的共享主机路由的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆