2010-12-16 57 views
0

我想用的.htaccess添加一個文件結尾(.KML)的URL,但它不工作使用.htaccess添加文件結尾?

URL是http://resihop.nu/kml 我想這是http://resihop.nu/kml.kml這是我的嘗試:

重寫規則^ kml.kml $ KML

這裏是我的全部.htacess:

# Turn on URL rewriting 
RewriteEngine On 

# Installation directory 
RewriteBase/

# Protect hidden files from being viewed 
<Files .*> 
    Order Deny,Allow 
    Deny From All 
</Files> 

# Protect application and system files from being viewed 
RewriteRule ^(?:application|modules|system)\b.* index.php/$0 [L] 

# Allow any files or directories that exist to be displayed directly 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 

# Rewrite all other URLs to index.php/URL 
RewriteRule .* index.php/$0 [PT] 

RewriteRule ^kml\.kml$ kml 

回答

0

您需要告訴服務器如何處理.kml文件。該行添加到您的.htaccess

AddType application/x-httpd-php .kml 

(假設你想.KML文件被解析爲PHP。)

編輯:沒關係,我只是重新閱讀你的問題,我知道這是不是你的問題。只是不理我!

0

這應該爲您的使用您自己的分機的情況下工作:

Options +FollowSymlinks 
RewriteEngine On 
RewriteBase/
RewriteRule ^(.+)\.kml$ /$1.php [NC,L] 

然後,您可以訪問任何帶.kml擴展名的文件,例如hello.kml。

希望這會有所幫助。

+0

不,我不害怕:/ – Himmators 2010-12-16 12:26:34

相關問題