我使用我的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. 访问服务器端方法/控制
- 4. 无法从Angular访问服务器端控制器
- 5. Windows服务无法访问其他项目在运行时
- 6. ios - 无法从其他视图控制器访问数据
- 7. Apache服务器无法从其他系统访问
- 8. Apache - 无法通过其他设备访问xampp服务器
- 9. 无法访问Kohana中的控制器,使用index.php虽然
- 10. 从其他服务器访问MongoDB
- 11. AngularJS - 无法使用控制器方法访问服务
- 12. 无法从服务控制器启动Windows服务
- 13. 无法从控制器访问服务angularjs
- 14. 从其他控制器问题访问方法的iOS
- 15. 没有梨的其他服务器
- 16. 无法访问Windows服务器上的Neo4j浏览器
- 17. Google App Engine - 开发服务器 - 无法从其他机器访问
- 18. windows服务无法访问web服务
- 19. Windows服务无法在Windows 2003服务器中访问VB.net中的文件
- 20. 在控制器外部访问容器但无法注入服务
- 21. 访问服务内部控制器
- 22. 从控制器访问服务层
- 23. SaltStack文件服务器访问控制
- 24. 无法在我的其他视图控制器中访问我的阵列
- 25. Objective-C - 从其他控制器访问方法
- 26. 无法访问元素父控制器
- 27. 解析Migartion +“无法访问服务器”+自托管服务器
- 28. ldap服务器无法访问导致plone/zope服务器down
- 29. 访问服务器没有地址
- 30. 无法将服务注入控制器
谢谢chika johnson – SRJ