0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Laravelのプロジェクトをxamppのサブドメインで配信してみる

Last updated at Posted at 2020-06-18

####xamppのhtdocs直下に新規ディレクトリの作成

#####ディレクトリ名をdevelop-sampleとして作成

####新規に作成したディレクトリに移動してLaravelのプロジェクトの作成

 composer create-project "laravel/laravel=6.*" laravel-dev

####次にLaravelのプロジェクトをxamppのサブドメイン上で配信する為に C:\xampp\apache\conf\httpd.confファイルに追加する

// Alias/任意のドメイン名 /xampp/htdocs/任意のディレクトリ名/任意のプロジェクト名/public
Alias /sample-dev /xampp/htdocs/develop-sample/laravel-dev/public

//<Directory "C:/xampp/htdocs/任意のディレクトリ名/任意のプロジェクト名/public">
<Directory "C:/xampp/htdocs/develop-sample/laravel-dev/public">

    Options Includes ExecCGI FollowSymLinks
    AllowOverride All
    Require all granted
    Order allow,deny
    Allow from all
</Directory>

<Directory />
   #AllowOverride none
    AllowOverride All
    Require all granted
   #Require all denied
</Directory>

####Laravel側のプロジェクト/public/.htaccessファイルに変更を加える

 # Redirect Trailing Slashes If Not A Folder...
     RewriteCond %{REQUEST_FILENAME} !-d
     RewriteCond %{REQUEST_URI} (.+)/$

 //  RewriteRule ^(.*)/$/任意のサブドメイン名/$1 [L,R=301]
     RewriteRule ^(.*)/$/sample-dev/$1 [L,R=301]

 //  RewriteBase /任意のサブドメイン名/
     RewriteBase /sample-dev/
     RewriteRule ^index\.html$ - [L]

####最後にxamppを再起動をかける

再起動後、確認の為(http://localhost/任意のサブドメイン名/) にアクセスしてみよう
 アクセス時にlaravelのTOP画面が表示されればOK お疲れ様です。

###参考にしたサイト
https://minory.org/laravel-subdirectry.html

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?