Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/233.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php .htaccess和本地多域_Php_.htaccess - Fatal编程技术网

Php .htaccess和本地多域

Php .htaccess和本地多域,php,.htaccess,Php,.htaccess,需要htaccess文件的litlle帮助。我有一个本地站点http://foo.bar,它与$\u服务器['REQUEST\u URI']值一起工作。在站点的根目录中,存在具有规则的.htaccess文件 DirectoryIndex index.php Options -Indexes RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f Rewrit

需要htaccess文件的litlle帮助。我有一个本地站点
http://foo.bar
,它与$\u服务器['REQUEST\u URI']值一起工作。在站点的根目录中,存在具有规则的.htaccess文件

DirectoryIndex index.php
Options -Indexes
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
AddDefaultCharset UTF-8
该站点的文档根与
http://localhost/foo
。当我打开
http://localhost/foo/user/login
,我得到404错误。同样的链接在
http://foo.bar/user/login
http://localhost/foo/index.php/user/login


在url中没有index.php的localhost/foo url站点上使用currect时,我需要在.htaccess文件中编写什么?

尝试查看apache错误日志,查看apache试图将该请求映射到的不存在的文件。尝试相应地设置RewriteBase。