httpd.conf
找到DocumentRoot 将路径更改为项目根目录
然后在项目根目录中新建一个.htaccess文件,加入以下代码
<ifmodule mod_rewrite.c> RewriteEngine On RewriteCond %{QUERY_STRING} ^(.*) RewriteRule ^([a-z]{2,10})/$ /index.php?controller=$1&%1 RewriteCond %{QUERY_STRING} ^(.*) RewriteRule ^([a-z]{2,10})\/([a-z]{1,20})/$ /index.php?controller=$1&action=$2&%1 </ifmodule>
当访问localhost:9090/index/index/时,等同于访问localhost:9090/index.php?controller=index&action=index
时间: 2024-10-26 20:18:05