本文介绍了.htaccess问题:未指定输入文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以帮我这个。我感觉自己已经打了我的头靠在墙上超过2小时,现在。



我有Apache 2.2.8 + PHP 5.2.6安装在我的机器和.htacces与代码下面工作正常,没有错误。

  RewriteEngine on 
RewriteCond $ 1! (index\.php | css | gfx | js | swf | robots \.txt | favicon\.ico)
RewriteRule ^(。*)$ /index.php/$1 [L]

托管服务提供商服务器上的代码相同,只给我一个404错误代码并且输出:没有指定输入文件。 index.php是有。我知道他们安装了Apache(无法找到版本信息),他们正在运行PHP v5.2.8。



我在windows xp 64位,重新运行一些Linux与php在cgi / fastcgi模式。任何人都可以建议可能是什么问题?



PS。如果这对于CodeIgniter使用友好的网址很重要。






Update1:​​



mod_rewrite已安装并开启。



我注意到的是,如果我将RewriteRule更改为/index.php?$1(问号而不是正斜线),它进入一个无限循环。无论如何,使用问号不是一个选项,因为CodeIgniter(必需)不会这样工作。



直接请求index.php时,首页也工作:example .com / index.php



我开始认为可能是apache认为一旦添加了尾部斜杠,它不再是一个文件,而是一个文件夹。如何更改此类行为?


$ b

>我错了。

Apache正确处理这些网址。

请求(首页)或任何其他有效地址工作。

看来Apache只是由于某种原因而无法转发查询。






更新3:



我试图实现。

我要重写这样的地址:

=>
=>

解决方案

我正在殴打我的头。我也安装了代码Igniter。



goocher不是RewriteBase。这是我的.htaccess:

  DirectoryIndex index.php 

RewriteEngine on
RewriteBase /
RewriteCond%{REQUEST_FILENAME}!-f
RewriteCond%{REQUEST_FILENAME}!-d
RewriteCond $ 1!^(index\.php | robots\.txt)

RewriteRule ^(。*)$ index.php?/ $ 1 [L]


Can someone help me with this. I'm feeling like I've been hitting my head against a wall for over 2 hrs now.

I've got Apache 2.2.8 + PHP 5.2.6 installed on my machine and the .htacces with code below works fine, no errors.

RewriteEngine on
RewriteCond $1 !^(index\.php|css|gfx|js|swf|robots\.txt|favicon\.ico)
RewriteRule ^(.*)$ /index.php/$1 [L]

The same code on my hosting provider server gives me a 404 error code and outputs only: No input file specified. index.php IS there. I know they have Apache installed (cannot find version info anywhere) and they're running PHP v5.2.8.

I'm on windows xp 64-bit, they're running some Linux with php in cgi/fastcgi mode. Can anyone suggest what could be the problem?

PS. if that's important that's for CodeIgniter to work with friendly URLs.


Update1:

mod_rewrite is installed and on.

What I've noticed is that if I change in RewriteRule to /index.php?$1 (question mark instead of forward slash) it goes into an infinite loop. Anyway, using question mark isn't an option as CodeIgniter (required) is not going to work this way.

Homepage also works when I request index.php directly: example.com/index.php

I'm starting to think it might be apache thinking that once the trailing slash is added it is not a file anymore but a folder. how to change such a behaviour?


Update 2:

I was wrong.
Apache handles these urls correctly.
Requesting http://example.com/index.php/start/ (homepage) or any other valid address works.
Seems that Apache is just not forwarding the query for some reason.


Update 3:

Just to be clear what I'm trying to achieve.
I want to rewrite addresses like that:
http://www.example.com/something/ => http://www.example.com/index.php/something/http://www.example.com/something/else/ => http://www.example.com/index.php/something/else/

解决方案

I was beating my head up against this as well. I'm also installing Code Igniter.

The goocher was no RewriteBase. Here's my .htaccess:

DirectoryIndex index.php

RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|robots\.txt)

RewriteRule ^(.*)$ index.php?/$1 [L]

这篇关于.htaccess问题:未指定输入文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 07:29