php_mvc示例。产生404错误的链接
(第一个问题,所以请接受帕斯的任何礼节) 我试图了解PHP MVC,所以我想我会尝试看看这个项目。我已经阅读了所有的安装说明,并且在浏览器中很好地显示了标准的首页 每当我试图点击链接时,就会出现404错误 据我所知,这是因为MVC(?)的url变化特性 我将.htaccess文件更改如下:php_mvc示例。产生404错误的链接,php,apache,.htaccess,mod-rewrite,Php,Apache,.htaccess,Mod Rewrite,(第一个问题,所以请接受帕斯的任何礼节) 我试图了解PHP MVC,所以我想我会尝试看看这个项目。我已经阅读了所有的安装说明,并且在浏览器中很好地显示了标准的首页 每当我试图点击链接时,就会出现404错误 据我所知,这是因为MVC(?)的url变化特性 我将.htaccess文件更改如下: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /MCVxample/ RewriteCond %{REQUEST_FILENAME}
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /MCVxample/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite all other URLs to index.php/URL
RewriteRule ^(.*)$ index.php?url=$1 [PT,L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 index.php
</IfModule>
<VirtualHost *:80>
ServerName symp.localhost
DocumentRoot C:\xampp\htdocs
SetEnv APPLICATION_ENV "development"
<Directory C:\xampp\htdocs>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
重新启动发动机
重写BASE/MCVxSample/
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
#将所有其他URL重写为index.php/URL
重写规则^(.*)$index.php?url=$1[PT,L]
ErrorDocument 404 index.php
我还设置了httpd.conf(使用XAMPP3.2.1)文件,如下所示:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /MCVxample/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite all other URLs to index.php/URL
RewriteRule ^(.*)$ index.php?url=$1 [PT,L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 index.php
</IfModule>
<VirtualHost *:80>
ServerName symp.localhost
DocumentRoot C:\xampp\htdocs
SetEnv APPLICATION_ENV "development"
<Directory C:\xampp\htdocs>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
ServerName symp.localhost
DocumentRoot C:\xampp\htdocs
SetEnv应用程序_ENV“开发”
DirectoryIndex.php
允许超越所有
命令允许,拒绝
通融
我还确保LoadModule rewrite\u module modules/mod\u rewrite.so
行未注释
有人能帮我解决我做错的事吗
提前谢谢
马特在这一切之后,它变成了一种类型
Id将
RewriteBase/MCVxample/
替换为RewriteBase/MVCxample/
urrg。修好了。这是我的.htdocs文件中的一个输入错误。。我把RewriteBase/MCVxample/改为RewriteBase/MVCxample/这是一个什么样的eediot。你真的不应该把这段代码作为例子。除了与MVC无关外,它还包含非常糟糕的实践。谢谢。你能突出我使用的教程网站的片段吗?