
SetEnv PHP_VALUE "upload_max_filesize = 6M"

# フロントから管理画面のアクセス拒否
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} ^.*/webmaster|^.*/posapi
RewriteRule ^(.*)$ /404.php [R=301,L]
</IfModule>

# ポート番号が付加されてしまう場合、取り除いたHTTP_HOSTの生成
#RewriteCond %{HTTP_HOST} !^(.*):443$
#RewriteRule .* - [E=X_HTTP_HOST:%{HTTP_HOST}]
#RewriteCond %{HTTP_HOST} ^(.*):443$
#RewriteRule .* - [E=X_HTTP_HOST:%1]

# パスによってHTTP/HTTPSを切り替えるための設定
#RewriteCond %{HTTPS} off
#RewriteRule ^(.*)$ https://%{ENV:X_HTTP_HOST}%{REQUEST_URI} [R=301,L,QSA,NE]

# 管理画面のBasic認証対応
#SetEnvIf Request_URI "/webmaster*" noauth

#AuthUserFile /var/www/.htpasswd
#AuthName "Input your ID and Password."
#AuthType Basic
#require valid-user

#Satisfy any
#Order Deny,Allow
#Deny from all
#allow from env=!noauth

<FilesMatch "\.pdf$">
    Header set X-Robots-Tag "noindex"
</FilesMatch>

<FilesMatch "\.js$">
    Header set X-Robots-Tag "noindex"
</FilesMatch>

<Files "web.config">
    Order Deny,Allow
    Deny from all
</Files>

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    # ECHOSYU2-1792対応
    RewriteRule ^guide/site$ - [R=404,L]
    RewriteRule ^guide/first$ - [R=404,L]
    RewriteRule ^ladies/guide/it$ - [R=404,L]
    RewriteRule ^ladies/guide/ite$ - [R=404,L]
    RewriteRule ^ladies/guide/reservation$ - [R=404,L]
    RewriteRule ^ladies/guide/correction/1000$ - [R=404,L]
    
    # ダブルスラッシュを含むURLを正規化（スラッシュ1つに）
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+(.*/)/+ [OR]
    RewriteCond %{REQUEST_URI} ^//+
    RewriteRule ^(.*)$ /$1 [R=301,L]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteCond %{REQUEST_URI} !^/display/display/$
    RewriteCond %{REQUEST_URI} !^/display/item/$
    RewriteCond %{REQUEST_URI} !^/sp/display/item/$
    RewriteCond %{REQUEST_URI} !^/display/article/detail/$
    RewriteCond %{REQUEST_URI} !^/sp/display/article/detail/$
    RewriteRule ^ %1 [L,R=301]

    # wwwなしのページへリダイレクト
    # haruyama
    RewriteCond %{HTTP_HOST} ^www\.haruyama\.jp$
    RewriteRule ^(.*)$ https://haruyama.jp/$1 [R=301,L]
    # foel
    RewriteCond %{HTTP_HOST} ^www\.foel\.jp$
    RewriteRule ^(.*)$ https://foel.jp/$1 [R=301,L]
    #psfa
    RewriteCond %{HTTP_HOST} ^www\.perfect-s\.com$
    RewriteRule ^(.*)$ https://perfect-s.com/$1 [R=301,L]

    # index.htmlなしのページへリダイレクト
    RewriteRule ^(.*)index\.html$ /$1 [R=301,L]

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

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

</IfModule>

