apache rewrite thinkphp重写伪静态,加.html后缀
2017-05-06 00:00
1386 查看
由于thinkphp的url不带.html后缀也能访问,于是通过apache rewrite规则重写了301重定向,
类似于domain.com/news/3之类的url全部跳转到domain.com/news/3.html
.htaccess文件如下
类似于domain.com/news/3之类的url全部跳转到domain.com/news/3.html
.htaccess文件如下
<IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_URI} !(\.html)$ [NC] RewriteRule ^/?(.*)$ /$1.html [QSA,R=301,L] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L] </IfModule>
相关文章推荐
- PHP的mod_rewrite重写模块将.php后缀换成.html
- 将aspx重写成.html后缀的伪静态地址后,如果后台需要调用Session,可能会出现如下错误:
- apache中配置PHP伪静态Rewrite重写
- Apache的rewrite重写相关的参数详解说明(伪静态)
- PHP的mod_rewrite重写模块将.php后缀换成.html
- apache 开启 rewrite 重写规则 apache 目录 htaccess rewrite 重写规则 (伪静态)
- Apache伪静态html(URL Rewrite)设置法
- thinkphp url链接自动被加上了后缀html(如何修改)
- apache配置伪静态Rewrite
- Apache的rewrite的重写相关的参数
- Apache的rewrite的重写相关的参数
- Apache主机rewrite地址重写相关的参数
- Apache的Mod_rewrite学习(RewriteRule重写规则的语法)
- RewriteCond和13个mod_rewrite应用举例Apache伪静态
- 打开Apache的rewrite模式,使thinkphp可以用rewrite模式地址
- url重写—适用html为伪静态后真实的html无法访问的解决方法
- ThinkPHP重写规则优化URL及Rewrite规则详细说明
- Apache的Mod_rewrite学习 (RewriteCond重写规则的条件)
- Apache的rewrite模块(url重写模块)配置
- 通过Apache的URL地址重写(附伪静态方式)