iT邦幫忙

0

【Codeigniter】-Mod_Rewrite-菜鳥日記(2)

  1. Rewrite 要打開Apache
    接著我們寫入以下資料,記住要新增在<VirtualHost *:80>底下:
<Directory /var/www/html>
  Options Indexes FollowSymLinks MultiViews
  AllowOverride All
  Order allow,deny
  allow from all
</Directory>
sudo a2dissite 000-default.conf //取消作用
sudo a2ensite laravel.conf //激活
sudo a2enmod rewrite //開啟Apache的mod_rewrite功能
sudo service apache2 restart //重啟Apache
  1. .htaccess
RewriteEngine on
RewriteCond $1 !^(index\.php|assets|fonts|images|img|js|css|uploads|favicon.png)
RewriteCond %(REQUEST_FILENAME) !-f
RewriteCond %(REQUEST_FILENAME) !-d
RewriteRule ^(.*)$ ./index.php/$1 [L]

尚未有邦友留言

立即登入留言