1
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 5 years have passed since last update.

DocumentRootから別ディレクトリにredirect

Posted at

#「.htaccess」で実装するやり方

httpd.confで編集するとシステムの再起動が必要になってくるのでこの方法で実装。
※Apacheサーバーでの実装になります。

実際にサーバーで記載する時は下記の「〇〇〇」をディレクトリ名に変更して記載する。

.htaccess
RewriteEngine On
RewriteRule ^$ 〇〇〇/ [L]
RewriteCond %{REQUEST_FILENAME} !-f
# !-f は存在するファイル名にはルールを適用しない
RewriteCond %{REQUEST_FILENAME} !-d
# !-d は存在するディレクトリ名にはルールを適用しない
RewriteRule ^(.+)$ 〇〇〇/$1 [L]

##オプション

定義名 説明
REQUEST_FILENAME ドメインの後に入力されたファイル名orディレクトリ名を参照する。

サーバー関係の定義関数はまとめていきたい

1
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
1
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?