修复了它。对文件做了一个小更改。从下面可以看出。
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.php?$1 [NC,QSA,L]
我一整天都在努力解决我遇到的一个问题。我有一个.htaccess文件,它只是像一样重写url
http://example.com/about/?req=true
http://example.com/index.php/about/?req=true
它在本地主机上运行没有问题,但当我将它上传到服务器时,我会收到"未指定输入文件"的错误。您可以在下面看到.htaccess文件的内容。
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*) index.php/$1 [L]
我尝试了在互联网上找到的不同的东西,包括添加一个php.ini文件,将cgi.fix_pathinfo设置为1,但除了一个之外,其他都不起作用,而且这个文件不读取请求字符串。你可以在下面看到这个。
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*?)/?$ /index.php?x=$1 [L]
提前谢谢。
首先检查重写模块是否在apache中启用如果启用,那么你可以在url 中使用此代码隐藏index.php
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /base_directory_name/
RewriteRule ^index'.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /base_directory_name/index.php [L]
</IfModule>
我想这会对你有所帮助。