2011-03-13 77 views

回答

2

你需要創建一個名爲」的.htaccess'一個特殊的文件,並把它在您的Web應用程序根目錄中。文件的內容可以是這樣的:

Options +FollowSymLinks 
RewriteEngine on 

RewriteRule ^/home$ /index.php?page=home [L] 

然後配置Apache(httpd.conf中的httpd-vhosts.conf),讓您的Web應用程序使用的.htaccess配置文件

<VirtualHost 127.0.0.1:80> 
    DocumentRoot "/path/to/your/webapp" 
    ServerName localhost 
    <Directory "/path/to/your/webapp"> 
     AllowOverride All 
      Order allow,deny 
      Allow from all 
    </Directory> 
</VirtualHost> 

這是一個很好的閱讀。

http://httpd.apache.org/docs/current/misc/rewriteguide.html

1

沒有重定向PHP不能做到這一點,但也有解決方案的主機:用Apache(.htaccess)是否

使用mod_rewrite

RewriteEngine on 
RewriteRule ^home$ /index.php?page=home 

另一個辦法是添加一個index.php到/ home這只是函數是包含文檔根目錄index.php。

0

看看喜歡(我的最愛)CodeIngniter在Zend框架,但不限於,或嘗試如果您使用的是Apache,你可以看看htaccess的腳本,通過打造專業化您自己的路由器

0

推倒重來。谷歌搜索有大量的選項可供選擇

相關問題