すべての不明なリクエストを index.html にリダイレクトしようとしています。たとえば、誰かが次のように入力した場合:
http://IP_Address/blah_blah _blah
次に、index.html にリダイレクトする必要があります。以下は私が試したコードです:
私は自分のルートディレクトリを下に持っています/var/www/some_dir/index.html
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/index.html$
RewriteRule . index.html [R=302,L]
このコードを試したところ、リダイレクトされましたhttp://Ip_address/var/www/accesspage/index.html
私が欲しいhttp://Ip_address/index.html
しかし、index.htmlを介して他のhtmlページにリダイレクトしたい
以下は私のApache設定です
DocumentRoot /var/www/access/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/access/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>