能夠經過URL重寫隱藏應用的入口文件index.php
,下面是相關服務器的配置參考:php
【Apache】html
<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>apache
以上操做所有都完成,重啓apache後仍是失敗,緣由在與include的【httpd-vhosts.conf】中配置沒有改爲容許URL重寫。服務器
只需將ide
DocumentRoot "F:/wamp/www/test" ServerName www.test.com ServerAlias admin.tpshop.com DirectoryIndex index.html index.htm index.php Options FollowSymLinks AllowOverride none Order allow,deny Allow from all
改爲spa
DocumentRoot "F:/wamp/www/test" ServerName www.test.com ServerAlias admin.tpshop.com DirectoryIndex index.html index.htm index.php Options FollowSymLinks AllowOverride All Order allow,deny Allow from all
而後保存,重啓apache就能夠了。code