Ubuntu下启动Apache对.htaccess文件的支持

February 10, 2009

步骤很简单:

  1. 终端运行
    sudo a2enmod

    程序提示可供激活的模块名称,输入:

    rewrite

  2. 修改/etc/apache2/sites-enabled/000-default (该链接指向的是站点配置文件)
    (默认的www目录、或者需要应用.htaccess的目录)下的AllowOverride 属性改为All,保存。
  3. 重新加载apache
    sudo /etc/init.d/apache2 restart

    收工。

a2xx系列的命令共有a2dismod、a2enmod、a2dissite、a2ensite,作用分别是禁用模块、启用模块、停用站点、启用站点,这些命令简单得连--help选项都没有,只能运行看提示。其作用也很简单,就是在/etc/apache2/mods-enabled和/etc/apache2/sites-enabled里面建立或删除相对应的x-available目录里面的模块的链接。

Ubuntu的配置文件都有这个特点,预设了各种配置文件,只需要把要用的链接到生效的目录里面。在/etc下面看看很多类似的情况,这就是Ubuntu的方便之处(虽然对新手来说可能是麻烦之处)。

tags: , , ,
posted in Unix/Linux by PT

Follow comments via the RSS Feed | Leave a comment | Trackback URL

2 Responses to Ubuntu下启动Apache对.htaccess文件的支持

  1. Pingback: Godaddy子域名转发 | 约翰的自由博客

  2. 应酷 says:

    非常感谢,解决了

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">

Page optimized by WP Minify WordPress Plugin

 
Powered by Wordpress and MySQL. Theme by Shlomi Noach, openark.org