您的位置:首页 > 运维架构 > Apache

Apache重写模块:规则详解

2014-12-17 10:57 351 查看
1,开其重写模块:

  sudo a2enmod rewrite

2,配置为可重写:

  打开 /etc/apache

  < Directory />
    Options FollowSymLinks
    AllowOverride All
  < /Directory>

在项目目录下,新建 .htaccess文件,加入以下内容:

<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
RewriteBase /

#重写条件
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f

#重写规则
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>


3,重写规则:

  

  

  
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: