我使用我的htaccess從url中刪除index.php。應用程序在我的電腦上正常工作。我使用XAMPP。但當我上傳到服務器它只顯示主頁,我不能訪問其他控制器沒有index.php在Windows Live服務器無法訪問其他控制器沒有index.php在Windows Live服務器
1
A
回答
2
Hta訪問不會在Windows Live服務器工作,你必須修改根文件夾中的web.config文件你的項目,並在這樣的部分下添加重寫代碼。肯定它會幫助你。
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Rule" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
<add input="{URL}" pattern="^/favicon.ico$" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="index.php/{R:1}" appendQueryString="true" />
</rule>
</rules>
</rewrite>
<directoryBrowse enabled="true" />
<defaultDocument>
<files>
<clear />
<add value="Default.htm" />
<add value="Default.asp" />
<add value="index.htm" />
<add value="Default.aspx" />
<add value="index.php" />
<add value="index.html" />
<add value="index.pl" />
<add value="default.html" />
<add value="Default.cshtml" />
</files>
</defaultDocument>
<httpProtocol>
<customHeaders>
<clear />
</customHeaders>
</httpProtocol>
</system.webServer>
</configuration>
1
我有類似的問題。將此文件放在根目錄下的.htaccess文件中。這解決了我的問題。
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ index.php?/$1 [L]
相關問題
- 1. 無法訪問其他控制器
- 2. 服務控制器無法啓動服務 - 訪問被拒絕
- 3. JavaFX控制器如何訪問其他服務?
- 4. 訪問服務器端方法/控制
- 5. 無法從Angular訪問服務器端控制器
- 6. Windows服務無法訪問其他項目在運行時
- 7. ios - 無法從其他視圖控制器訪問數據
- 8. 無法訪問控制器Codeigniter的其他功能
- 9. 訪問控制服務2.0可用於Windows服務器?
- 10. Apache服務器無法從其他系統訪問
- 11. Apache - 無法通過其他設備訪問xampp服務器
- 12. 無法從其他計算機訪問sinatra服務器
- 13. 無法訪問Kohana中的控制器,使用index.php雖然
- 14. 從其他服務器訪問MongoDB
- 15. AngularJS - 無法使用控制器方法訪問服務
- 16. 從其他控制器訪問控制器的功能
- 17. 從其他控制器的訪問控制器
- 18. EmberJS - 從其他控制器訪問應用程序控制器
- 19. Symfony控制器無法訪問容器
- 20. 無法從服務控制器啓動Windows服務
- 21. Angular:無法使用服務訪問控制器中的變量
- 22. 無法訪問兩個控制器上的服務AngularJs
- 23. 無法從控制器訪問服務angularjs
- 24. 無法訪問Live Server中的codeigniter控制器,但可以在本地主機訪問(在Windows上的xampp)
- 25. $ rootScope無法在控制器中訪問
- 26. 從其他控制器問題訪問方法的iOS
- 27. 沒有梨的其他服務器
- 28. 訪問服務內部控制器
- 29. SaltStack文件服務器訪問控制
- 30. 從控制器訪問服務層
謝謝chika johnson – SRJ