Php .htaccess文件没有';t使用路径信息和/或get方法无法正常工作

Php .htaccess文件没有';t使用路径信息和/或get方法无法正常工作,php,apache,.htaccess,mod-rewrite,Php,Apache,.htaccess,Mod Rewrite,修好了。对文件做了一点小改动。可以在下面看到 RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule (.*) index.php?$1 [NC,QSA,L] 我花了一整天的时间来解决我遇到的一个问题。我有一个.htaccess文件,它只是像 http://example.com/about/?req=true http://example.

修好了。对文件做了一点小改动。可以在下面看到

RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule (.*) index.php?$1 [NC,QSA,L]

我花了一整天的时间来解决我遇到的一个问题。我有一个.htaccess文件,它只是像

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]
我尝试了在internet上找到的不同方法,包括添加一个php.ini文件,该文件将cgi.fix_pathinfo设置为1,但除了一个之外,其他方法都不起作用,并且该文件不读取请求字符串。你可以看到下面的那个

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

提前感谢。

首先检查是否在apache中启用了重写模块 如果启用,那么您可以在url中使用此代码hide 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>

重新启动发动机
重写base/base\u目录\u名称/
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/base_directory_name/index.php[L]

我想这会对你有帮助

您想重写
http://example.com/about/?req=true
http://example.com/index.php/about/?req=true
?文件下的目录如何工作(即使在区域设置计算机上)?不应该是这样的吗<代码>http://example.com/about/index.php?req=true或类似的
http://example.com/index.php?req=true&page=about
?@serjoscha我想你弄错了。我在这里尝试的是使用$\u SERVER['path\u info']以更好的方式处理用户友好的URL。