Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.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/5/date/2.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 Mod rewrite未重写_Php_Apache_.htaccess_Mod Rewrite_Url Rewriting - Fatal编程技术网

Php Mod rewrite未重写

Php Mod rewrite未重写,php,apache,.htaccess,mod-rewrite,url-rewriting,Php,Apache,.htaccess,Mod Rewrite,Url Rewriting,我有以下文件结构: /testrest/ /testrest/.htaccess /testrest/index.php Myindex.phpfile simple将文本回显到屏幕,以确认重写已指向该文件 我的.htaccess文件如下: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /testrest/ RewriteCond %{REQUEST_FILENAME} !-f Rewri

我有以下文件结构:

/testrest/
/testrest/.htaccess
/testrest/index.php
My
index.php
file simple将文本回显到屏幕,以确认重写已指向该文件

我的
.htaccess
文件如下:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /testrest/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php?_url=/$1 [QSA,L]
</IfModule>

重新启动发动机
重写BASE/testrest/
重写cond%{REQUEST_FILENAME}-F
重写规则^(.*)$index.php?\u url=/$1[QSA,L]
…但是在我重新启动Apache之后,它不会重写URL

例如:
http://:localhost/testrest/categories/

(我希望看到索引文件)我做错了什么


顺便说一句,我可以确认Mod rewrite已启用(如我执行
phpinfo()
时所见)

修改.htaccess文件时,您不需要重新启动apache(这就是它们的要点)。它以什么方式不起作用?您可能不需要
RewriteBase
。您的apache配置允许.htaccess文件吗?是的,Linux。我在Ubuntu服务器上。我只是想,如果启用了mod_rewrite,那么它就允许.htaccess。不是这样吗?编辑您的.htaccess并在文件顶部添加此代码
Options+FollowSymLinks
并重试。您在
/testrest/categories/
路径中是否有.htaccess?