Apache新的URL路由重写规则

在根目录下新建一个 .htaccess 后缀文件,将下面代码放进去即可

<IfModule mod_rewrite.c>
  Options +FollowSymlinks -Multiviews
  RewriteEngine On

  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1]
</IfModule>

 

------------------------------------------------------------------------------

其地址栏访问 例如:www.xxx.com/1.0/users/1

即可访问到同目录下index.php页面

在php里面常用于api接口来用,以前的代码不能用了,现在这个配置是新的记录下来。

posted @ 2019-10-28 16:06  Akai_啊凯  阅读(630)  评论(0编辑  收藏  举报