teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

htaccesの追加

2021/05/19 07:37

投稿

tiqua_nibio
tiqua_nibio

スコア62

title CHANGED
File without changes
body CHANGED
@@ -95,4 +95,76 @@
95
95
  q_enquiry.php
96
96
  q_first.sh
97
97
  ```
98
- htmlだとうまく表示されるのに、PHPファイルだと表示されないという点が気になっています。
98
+ htmlだとうまく表示されるのに、PHPファイルだと表示されないという点が気になっています。
99
+
100
+ (2021/05/19追加)
101
+ .htaccessについてです。ドキュメントルートにあるものです。originalディレクトリの中にはありません。
102
+
103
+ ```ここに言語を入力
104
+
105
+ <FilesMatch ".(engine|inc|install|make|module|profile|po|sh|.*sql|theme|twig|tpl(.php)?|xtmpl|yml)(~|.sw[op]|.bak|.orig|.save)?$|^(.(?!well-known).*|Entries.*|Repository|Root|Tag|Template|composer.(json|lock)|web.config)$|^#.*#$|.php(~|.sw[op]|.bak|.orig|.save)$">
106
+ <IfModule mod_authz_core.c>
107
+ Require all denied
108
+ </IfModule>
109
+ <IfModule !mod_authz_core.c>
110
+ Order allow,deny
111
+ </IfModule>
112
+ </FilesMatch>
113
+ Options -Indexes
114
+ DirectoryIndex index.php index.html index.htm
115
+ AddType image/svg+xml svg svgz
116
+ AddEncoding gzip svgz
117
+ <IfModule mod_php7.c>
118
+ php_value assert.active 0
119
+ </IfModule>
120
+ <IfModule mod_expires.c>
121
+ ExpiresActive On
122
+ ExpiresDefault A1209600
123
+ <FilesMatch .php$>
124
+ ExpiresActive Off
125
+ </FilesMatch>
126
+ </IfModule>
127
+ <IfModule !mod_rewrite.c>
128
+ FallbackResource /index.php
129
+ </IfModule>
130
+ <IfModule mod_rewrite.c>
131
+ RewriteEngine on
132
+ RewriteRule ^ - [E=protossl]
133
+ RewriteCond %{HTTPS} on
134
+ RewriteRule ^ - [E=protossl:s]
135
+ RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
136
+ RewriteRule "/.|^.(?!well-known/)" - [F]
137
+ RewriteCond %{REQUEST_URI} ^(.*)?/(install.php) [OR]
138
+ RewriteCond %{REQUEST_URI} ^(.*)?/(rebuild.php)
139
+ RewriteCond %{REQUEST_URI} !core
140
+ RewriteRule ^ %1/core/%2 [L,QSA,R=301]
141
+ RewriteRule ^core/install.php core/install.php?rewrite=ok [QSA,L]
142
+ RewriteCond %{REQUEST_FILENAME} !-f
143
+ RewriteCond %{REQUEST_FILENAME} !-d
144
+ RewriteCond %{REQUEST_URI} !=/favicon.ico
145
+ RewriteRule ^ index.php [L]
146
+ RewriteCond %{REQUEST_URI} !/core/[^/]*.php$
147
+ RewriteCond %{REQUEST_URI} !/core/modules/system/tests/https?.php
148
+ RewriteCond %{REQUEST_URI} !/core/modules/statistics/statistics.php$
149
+ RewriteRule "^(.+/.*|autoload).php($|/)" - [F]
150
+ <IfModule mod_headers.c>
151
+ RewriteCond %{HTTP:Accept-encoding} gzip
152
+ RewriteCond %{REQUEST_FILENAME}.gz -s
153
+ RewriteRule ^(.*).css $1.css.gz [QSA]
154
+ RewriteCond %{HTTP:Accept-encoding} gzip
155
+ RewriteCond %{REQUEST_FILENAME}.gz -s
156
+ RewriteRule ^(.*).js $1.js.gz [QSA]
157
+ RewriteRule .css.gz$ - [T=text/css,E=no-gzip:1,E=no-brotli:1]
158
+ RewriteRule .js.gz$ - [T=text/javascript,E=no-gzip:1,E=no-brotli:1]
159
+ <FilesMatch "(.js.gz|.css.gz)$">
160
+ Header set Content-Encoding gzip
161
+ Header append Vary Accept-Encoding
162
+ </FilesMatch>
163
+ </IfModule>
164
+ </IfModule>
165
+ <IfModule mod_headers.c>
166
+ Header always set X-Content-Type-Options nosniff
167
+ RequestHeader unset Proxy
168
+ </IfModule>
169
+
170
+ ```