Apache no input file specified. Perfect solution

Source: Internet
Author: User

[1]

I did not expect to encounter no input file specified because the project uses URL route, it may be a rewrite problem.

Record the solution.

1. Check whether doc_root sets this value.

2. Check the. HTA file. Many frameworks use index. php as the entry file.

Default

Rewriterule ^ (. *) $ index. php/$1 [QSA, PT, l]

In Apache FastCGI mode, the rule causes no input file specified.

Modify

Rewriterule ^ (. *) $ index. php [L, E = path_info: $1]

OK. The address is rewritten normally.


[2]

We all know that the use of pseudo-static is relatively friendly to search engines, and the homepage can be accessed when I enable the pseudo-static function of rewrite IN THE dreamhost space, when accessing the internal page, the system prompts "no input file specified. ".
Baidu searched and found that other space vendors also had this problem because the PHP used in the space is fast_cgi mode. In some cases, the path_info error cannot be correctly identified, that is, WordPress has the same problem. Fortunately, we found a solution!
First, let's take a look at the rules in the default. htaccess program such as WordPress and typecho:
Rewriteengine on
Rewritebase/
Rewritecond % {request_filename }! -F
Rewritecond % {request_filename }! -D
Rewriterule ^ (. *) $/index. php/$1 [l]

The prompt is "no input file specified.", that is, no valid file path is obtained. The solution found in Google is to modify the pseudo-static rules as follows:
Rewriteengine on
Rewritebase/
Rewritecond % {request_filename }! -F
Rewritecond % {request_filename }! -D
Rewriterule ^ (. *) $/index. php? /$1 [l]

Add a question mark (?) before the regular expression "$1". .


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.