我已使用此方法How do I disable directory browsing?禁用目录浏览。 现在,我可以将其重定向到特定页面吗?
实施例。 mysite.com/subdirectory/another_directory/
至mysite.com/sorry.php
我只需要这样做..
RewriteEngine on
RewriteBase /client/
php_value upload_max_filesize 15M
php_value post_max_size 15M
#Options -Indexes
RewriteRule ^downloads/files/?$ /sorry.php [L,NC,R=302]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php [L]
它有效!
答案 0 :(得分:1)
你的.htaccess:
php_value upload_max_filesize 15M
php_value post_max_size 15M
#Options -Indexes
RewriteEngine on
RewriteBase /client/
RewriteRule ^downloads/files/?$ /sorry.php [L,NC,R=302]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php [L]
答案 1 :(得分:0)
在.htaccess
文件中写:
Options -Indexes
ErrorDocument 403 /sorry.php [R=301,L]