2010-11-14 61 views
0

我想隱藏的URL文件擴展像 如果當前的URL是PHP:使用的.htaccess

HTTP隱藏URL文件擴展名://localhost/salsgiver/administrator/menus.php教派=約

再新建一層將完全

的http://本地主機/ salsgiver /管理者/菜單/宗派/約

等, simillarly如果當前的URL是

HTTP://localhost/salsgiver/administrator/products.php ID = 1

再新建一層將完全

的http://本地主機/ salsgiver/administrator/products/1

或有些不同的事情,讓觀衆無法猜測確切的網址。

我搜索谷歌和發現了一些事情上

http://roshanbh.com.np/2008/02/hide-php-url-rewriting-htaccess.html

,並使用,但它不工作,mod_rewrite的模塊,在Apache中同時啓用。當我創建.htaccess來保護所有使用的文件夾

deny from all 

它工作正常。

回答

0

你可以這樣做,但mod_rewrite的是容易得多,如果你使用一個單一的index.php,然後選擇打開(products.php或menus.php)

該文件對於單索引文件的使用方法:

RewriteRule ^(.*)$ index.php?query=$1 [L] 

對於多個文件:

RewriteRule ^(.*?)/(.*?)/(.*?)$ $1.php?$2=$3 [L]