0

htaccess に関する多くの回答を読み込もうとしましたが、抜け道が見つかりませんでした。webhosting でこのアーキテクチャをイメージしてください: root/public_html/subfolder htaccess ファイル (public_html に配置) に次のコードを追加することで、ブラウザでドメインを入力すると、ビジターは数字のない example.com/subfolder のサブフォルダーに着陸することを管理できます。コムで十分です。できます。私が今欲しいのは、訪問者がサブフォルダーではなく、ルート内に配置された「エクストラフォルダー」にリダイレクトされることです(フォルダー public_html が配置されているが public_html 内ではなく、同じレベルであるレベルルート)。したがって、このコードを変更する方法は次のとおりです。

# .htaccess main domain to subdirectory redirect
# Do not change this line.
RewriteEngine on
# Change example.com to be your main domain.
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
# Change 'subdirectory' to be the directory you will use for your main domain.
RewriteCond %{REQUEST_URI} !^/subfolder/
# Don't change the following two lines.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Change 'subdirectory' to be the directory you will use for your main domain.
RewriteRule ^(.*)$ /subfolder/$1
# Change example.com to be your main domain again.
# Change 'subdirectory' to be the directory you will use for your main domain
# followed by / then the main file for your site, index.php, index.html, etc.
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteRule ^(/)?$ /subfolder/index.html [L] 

/subfolder/ を ../extrafolder/ で変更しようとしましたが (二重ドットが 1 レベル上に移動すると仮定)、機能しません。何か案が?ありがとうございました

4

1 に答える 1