tp3.2.3 rewrite apache 配置
阿新 • • 發佈:2018-11-10
本配置建立於 在fastcgi模式下 1. 開啟rewrite拓展 # vi apache/conf/httpd.conf #找到rewrite_module, 並把#號去除,儲存 2.vi apache/conf/vhosts.conf #最下面新增一個域名對映目錄關係 <VirtualHost *:80> DocumentRoot "G:\study\WWW\tp3" ServerName www.tp3.com ServerAlias tp3.com <Directory "G:\study\WWW\tp3"> Options FollowSymLinks ExecCGI AllowOverride All Order allow,deny Allow from all Require all granted </Directory> </VirtualHost> 3.重啟apache 4.在thinkphp根目錄下找到.htaccess(沒有則新建)內容如下: <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php?s=$1 [QSA,PT,L] </IfModule> 5. 修改.hosts檔案 加上 tp3.com 127.0.0.1, 重啟apache,並瀏覽器訪問 tp3.com/Home/Index/index