2009-10-23 74 views
0

我正在編寫一個腳本(我希望)將廣泛分發,並且我希望確保它可以在儘可能多的服務器上運行。我的腳本的通用mod重寫htaccess文件

該腳本將需要.htaccess文件,但我學到了一些htaccess文件不是很便攜。

htaccess的需要做一個簡單的重定向,像這樣:

http://example.com/dir/string 

Redirect to... 

http://example.com/dir/index.php?string 

什麼將一個「通用」的.htaccess文件的樣子,將在所有Windows和Linux服務器的工作。

回答

1

嘗試......

RewriteEngine On 
# if the file|folder exists 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)/(.*)$ /$1/index.php?$2 [L,QSA] 
+0

我測試了這一點,並沒有奏效。 – Chad 2009-10-23 04:46:05

+0

我正在使用WampServer運行LAMP – Chad 2009-10-23 04:46:37

+0

你確定你已經正確安裝了mod_rewrite嗎? – 2009-10-23 04:55:43