2017-01-05 4 views
0

通常、laravelフレームワークのindex.phpは/ public_html/public /フォルダーにあります。 私のケースでは、これは私がのURLからindex.phpのを除外するために行う必要がありますどのようなchangment私の.htaccessファイル内のコード.htaccessファイルでurlからindex.phpを削除しています。コードはlaravelフレームワークにあります

RewriteEngine On 

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

# Handle Front Controller... 

Options -MultiViews 
RewriteEngine On 

RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule^index.php [L] 

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

ある/ public_htmlのフォルダに

のですか?

次のようにコードの構造は以下の通りである:

/public_html/sitemap.xml

/public_html/sitemap.htm

/public_htmlの/public_html/server.php /robots.txt

/public_html/readme.md

/public_html/index.php

/public_html/.htaccess

/public_htmlの公開/

/public_htmlの/データベース

/public_htmlの/設定

/public_htmlの/ cgi-bin

/public_html/bootstrap

/public_htmlの/アプリ


及び内部/ public_htmlの公開/


/public_html/public/web.config

/public_htmlの/パブリック/ロボット.txt

/public_html/public/favicon.ico

/public_htmlの/公共/アップロード

/public_htmlの/公共/ JSの

/public_htmlの/公共/ IMG

/public_htmlの/公共/ CSS

+0

http://stackoverflow.com/questions/37507209/how-to-hide-config-files-from-direct-access –

+0

はあまりにも(まだ)laravelに精通していないが、私はアプリを信じています。設定ファイルのベースフォルダを設定することができますすべての.htaccessフープを避けることができるあなたのアプリ – happymacarts

+0

あなたのホームページに行くなら、あなたは 'homepage.com/index.php'のようなものではなく、ホームページだけであることがわかります。何も変更する必要はありません。 – GabMic

答えて

1

publicフォルダーからindex.phpを移動することを強くお勧めします。 thisチュートリアルに従うことで、あなたがしようとしていることを達成することができました。

public_htmlフォルダから/appications/your-appフォルダにコードベースを移動し、publicフォルダの内容をpublic_html/your-appに移動します。

チュートリアルは自明です。

1

私はこのLaravelプロジェクトの構造も使用します(プロジェクトのフォルダ内のindex.php)。ルートフォルダに.htaccessファイルを作成します

  • をindex.phpにルートフォルダに

    1. リネームserver.phpという:私の場合は、次のやった

    をのIfModule mod_rewriteの内部でこのコードを挿入します。 C

    RewriteEngine On 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^(.*)/$ /$1 [L,R=301] 
    
    RewriteCond %{REQUEST_URI} !(\.css|\.ttf|\.woff|\.woff2|\.js|\.png|\.jpg|\.gif|robots\.txt)$ [NC] 
    
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteRule^index.php [L] 
    
    RewriteCond %{HTTP:Authorization} . 
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 
    
    RewriteCond %{REQUEST_URI} !^/public/ 
    RewriteRule ^(css|js|images|fonts)/(.*)$ public/$1/$2 [L,NC] 
    
  • 関連する問題