【问题标题】:how to setup the .htaccess for a subdomain on a shared hosting godaddy server如何在共享托管 Godaddy 服务器上为子域设置 .htaccess
【发布时间】:2017-12-09 22:09:27
【问题描述】:

我想在 godaddy 上上传我本地的 Laravel 项目,但我遇到了一些错误

错误

[Wed Jul 05 21:16:44.858396 2017] 
    [autoindex:error] [pid 21796:tid 139689709188864] 
    [client 99.240.235.234:57754] 
    AH01276: 
        Cannot serve directory /home/bugsbunny/public_html/sto.com/: 
            No matching DirectoryIndex (/home/bugsbunny/public_html/sto.com/public/index.php) 
    found, and server-generated directory index forbidden by Options directive

.htaccess

DirectoryIndex /home/bugsbunny/public_html/sto.com/public/index.php
<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ /home/bugsbunny/public_html/sto.com/public/index.php [L]

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>

我做过的步骤

  • 我编辑了 public/.htaccess 文件
  • 编辑的意思是改变第一行的目录和以RewriteRule开头的行
  • 我将此文件剪切并粘贴到根目录中
  • 我把项目上传到了godaddy

【问题讨论】:

    标签: laravel .htaccess laravel-5


    【解决方案1】:

    在 Godaddy 上,我发现使用此过程创建/上传 Laravel 应用程序更容易

    1- Create an addon domain or a sub-domain on Godaddy
    2- Install a Laravel app (Quick-install) on this domain/sub-domain
    3- Download this app on local (my computer) with Filezilla (or other sftp software)
    4- On local disk change the .env database access or (create a user+password+database on phpmyadmin/mysql with the information contain in the .env that Godaddy setup for you)
    5- finish up the app (Build the webapp project that you want to do).
    6- Upload the app to the server (except the .env) with Filezilla
    7- upload the database (mysql) from local to Godaddy
    

    因此无需更改 .htaccess 文件。

    【讨论】:

      【解决方案2】:

      为什么你不使用 laravel 的专用主机。获取你的服务器和 [digitaloccean 等] 并做你想做的事......

      【讨论】:

        猜你喜欢
        • 2016-11-16
        • 2016-06-02
        • 1970-01-01
        • 2016-11-20
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多