先开启伪静态。详情查看这篇文章:http://www.cnblogs.com/CyLee/p/5544119.html

 

然后在项目根目录中新建一个.htaccess文件,加入以下代码

正则中()的变量 == $1,$2,$3,$4...

&%1是忽略、去掉不关注的字符串

<ifmodule mod_rewrite.c>

RewriteEngine On

RewriteRule ^css/(.*) /MVC/V/A001/css/$1
RewriteRule ^js/(.*) /MVC/V/A001/js/$1

RewriteCond %{QUERY_STRING} ^(.*)
RewriteRule ^([a-zA-Z_]{2,10})/?$ /index.php?controller=$1&%1

RewriteCond %{QUERY_STRING} ^(.*)
RewriteRule ^([a-zA-Z_]{2,10})/([a-zA-Z_]{1,20})/?$ /index.php?controller=$1&action=$2&%1



</ifmodule>

当访问shenyi.com/index/index/时,等同于访问localhost:80/index.php?controller=index&action=index

相关文章:

  • 2022-12-23
  • 2021-05-11
  • 2022-02-26
  • 2021-06-22
  • 2021-06-19
  • 2022-12-23
  • 2022-12-23
  • 2021-10-11
猜你喜欢
  • 2021-05-15
  • 2021-10-20
  • 2021-08-12
  • 2022-01-07
  • 2021-07-20
  • 2022-02-13
  • 2021-11-29
相关资源
相似解决方案