Ubuntu 16.04 本地 php 项目 访问地址去掉 index.php
.htaceess
文件, 内容如下:RewriteEngine OnRewriteCond %{REQUEST_FILENAME} !-dRewriteCond %{REQUEST_FILENAME} !-fRewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
2. 在 /etc/apache2/site-avalible
文件夹中复制 000-dedault.conf
文件, 重命名为你的项目.conf, 如下:
cp 000-default.conf mysite.conf
并增加以下内容:
<VirtualHost *:80> ServerName www.mysite.com ServerAdmin webmaster@localhost DocumentRoot /home/www/mysite <Directory /home/www/mysite> Options Indexes FollowSymLinks AllowOverride All Require all granted Order allow,deny allow from all </Directory></VirtualHost>
3. 创建配置文件连接, 把新建的配置文件激活什么什么巴拉巴拉(当前目录 sites-avilable)
sudo a2ensite mysite.conf
sudo a2enmod rewrite
[重要]
systemctl restart apache2.service
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。