前提:linux,xampp,支持CI,把CI的文件放到 /opt/lampp/htdocs/test目錄下
第一步:
在test目錄下,與index.php同級下,添加 .htaccess文件,文件內容如下:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
修改apache的配置文件:
第二步: vim /opt/lampp/etc/httpd.conf
找到下列文字地方,把include前邊的#去掉
# Virtual hostsInclude etc/extra/httpd-vhosts.conf
apache需要支持.htaccess,找到下列文字
Options FollowSymLinks
AllowOverride None
改爲
Options FollowSymLinks
AllowOverride All
第三步:
要是想支持https,則加上443
vim /opt/lampp/etc/extra /httpd-vhosts.conf<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "/opt/lampp/htdocs/test"
ServerName wangt_test.com
ErrorLog "logs/test-error_log"
CustomLog "logs/test-access_log" common
</VirtualHost>
<VirtualHost *:443>
DefaultType application/x-httpd-php
ServerAdmin [email protected]
DocumentRoot "/opt/lampp/htdocs/test"
ServerName wangt_test.com
SSLEngine on
SSLCertificateFile "/opt/lampp/etc/ssl.crt/server.crt"
SSLCertificateKeyFile "/opt/lampp/etc/ssl.key/server.key"
ErrorLog "logs/test443-error_log"
CustomLog "logs/test443-access_log" common
</VirtualHost>
重啓 /opt/lampp/lampp restart 完事