在根目錄下添加文件 .htaccess
<IfModule mod_rewrite.c> Options +FollowSymlinks RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f #如果頁面出現"No input file specified." 請注釋第一條,啟用第二條 RewriteRule ^(.*)$ $1.php [QSA,PT,L] #RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L] #RewriteRule ^(.*)$ index.php [E=PATH_INFO:$1,QSA,PT,L] </IfModule>