2011-11-23 41 views
0

我想htaccess的重寫任何指向index.php /視圖/不管

domain.com/whatever 

指向

domain.com/index.php/view/whatever 

用戶仍然會看到在瀏覽器domain.com/whatever但幕後它會被瀏覽domain.com/index.php/view/whatever

+0

是,上視圖的index.php即'的index.php?查看參數='或'是的index.php \查看'所有目錄? –

+0

@ulrich它就像你看到它'index.php/view' – Pinkie

回答

1

在域的根目錄試試這個.htaccess文件中

RewriteEngine On 
RewriteBase/

#for all subdomains of domain.com 
RewriteCond %{HTTP_HOST} ^(.+)\.domain\.com$ [NC] 
RewriteCond %{REQUEST_URI} !^/index\.php/view.*$ [NC] 
RewriteRule ^(.*)$ index.php/view/$1 [L] 
+0

好吧它工作不正常。如果我嘗試去'test.doamin.com /任何'。它應該訪問'test.domain.com/index.php/view/whatever'頁面。有什麼缺失嗎? – Pinkie

+0

我將問題編輯爲更簡單的版本,但不包括等式中的子版本。也許這有幫助 – Pinkie

+0

當你去'test.domain.com.whatever'時會發生什麼,例如你有404嗎?您的域的根文件夾中是否存在文件夾「index.php/view /」? –

相關問題