dongqiulei1987 2014-08-27 10:21
浏览 50
已采纳

.htaccess重定向根文件夹上的所有内容

On my sites, when type www.abc.com/folder, it's redirect to index.php. And I want the script don't touch on others folder and files. So is there anyway to prevent this?

This is the .htaccess file:

RewriteEngine on
RewriteCond %{request_filename} -f
RewriteRule ^(.*) $1 [L]
RewriteRule ^([a-z]+)(/([^/]{0,32})(/.+)?)?$  index.php?a=$1&q=$3    [L]
  • 写回答

1条回答 默认 最新

  • drxkx6149 2014-08-27 10:26
    关注

    To redirect everything from root only to home page you can use this rule:

    RewriteEngine On
    
    RewriteRule ^[^/]+/?$ / [L,R]
    
    RewriteCond %{request_filename} -f
    RewriteCond %{request_filename} -d
    RewriteRule ^([a-z]+)(/([^/]{0,32})(/.+)?)?$ index.php?a=$1&q=$3 [L,QSA]
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?