$sudo apt-get install apache2
2.Enable rewrite module in apache
$sudo a2enmod rewrite $sudo /etc/init.d/apache2 restart
3.Modify config file
$sudo vim /etc/apache2/sites-enabled/000-default (Change "AllowOverride None" to "AllowOverride All") (Add following at top) RewriteEngine on RewriteCond %{HTTP:range} !(^bytes=[^,]+(,[^,]+){0,4}$|^$) RewriteRule .* - [F]
4.Create .htaccess file in the directory which to share
(Note:there can't be any space character or empty line)
$sudo touch .htaccess $sudo chmod 644 .htaccess $sudo vim .htaccess (add following lines,note redirect) Options +FollowSymLinks <IfModule mod_rewrite.c> RewriteEngine on ErrorDocument 404 /404.html Redirect 302 /README http://www.google.com/ </IfModule>
5.Restart web server
$sudo /etc/init.d/apache2 restart
沒有留言:
張貼留言