APACHE supports.htaccess pseudo static rewrite error No input file specified solution

  • 2020-05-10 23:22:01
  • OfStack

Find the httpd.conf file in your Apache installation folder, conf
Search for LoadModule rewrite_module modules/ mod_rewrite.so if there is a comment # in front of it.
Search for Options FollowSymLinks, then change AllowOverride None below it to AllowOverride All;

【 1 】

I didn't expect to meet No input file specified. Because URL route was used in the project, I figured it might be the problem of rewrite.
Record 1 for the solution.
1. Check if doc_root is set to this value
2. Check the.hta file. Many frames are index.php as the entry file.
The default
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
A rule in apache fastcgi mode results in No input file specified.
Modified into
RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1]
For OK, the address is normally rewritten.

【 2 】

As we all know, using pseudo-static is relatively friendly to search engines, and when I enabled the pseudo-static function of REWRITE in Dreamhost's space, the home page could be accessed, while when I visited the inside page, I was prompted: "No input file specified."
Baidu searched 1, and found that there are other space business also have this problem, the reason is that the PHP used in the space is fast_cgi mode, and in some cases, can not correctly identify path_info caused by the error, even if Wordpress also has a kind of problem, fortunately found a solution!
First of all, let's take a look at 1. The default rules in Wordpress and Typecho programs:


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 has been obtained. The solution found in Google is to modify 1 pseudo-static rule, as follows:


RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]

The regular result "$1" is preceded by an extra "?" Then the problem is solved.


Related articles: