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
Myindex.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?