- 购买成功的一口价域名还在售卖页面显示
- 导致网站降权的六种错误分析
- "saved from url"注释语句的作用
- String.Remove 方法 (Int32)
- 网站主机防止独立IP被恶意解析的解决方法
- PHP缓存数据,Cache的使用方法
- thinkphp6模型操作
- 检测到有潜在危险的 Request.Form 值问题
- 常见术语定义,B2B、B2C、SaaS、O2O、ERP、SPU、SKU、批次号等
- 触摸屏网站开发系列(一)-ios web App应用程序(ios meta)
邮箱:
手机:15383239821
index.php式伪静态_伪静态完美去掉index.php的方法
index.php式伪静态_伪静态完美去掉index.php的方法
环境说明: linux + Apache 2.0
网站根目录下,index.php 所在目录内寻找.htaccess文件,如有修改以下代码,如果没有可新建.htaccess。
同时添加强行跳转HTTPS
RewriteEngine On
RewriteBase /
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.*)?$ https://%{SERVER_NAME}/$1 [L,R]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [L]
内容来着谷歌搜索,博主暂时没有想起,再次遇到添加备注。
逛博客新发现,收集记录下次备用。
伪静态规则。主要作用:
1.去掉index.php
2.强制301跳转到https
3.将带www域名的301跳转至不带www域名
4.访问域名/index.php后301跳转到主域名。
RewriteEngine On
#伪静态
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L,E=PATH_INFO:$1]
#强制跳转https
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*) https://sjzsy.cn/$1 [L,R=301]
#带www的跳转至不带www域名
RewriteCond %{HTTP_HOST} !^sjzsy.cn$ [NC]
RewriteRule ^(.*)$ http://sjzsy.cn/$1 [L,R=301]
#index.php跳转
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteRule ^index\.php$ https://sjzsy.cn/ [R=301,L]
- 上一篇:apache的.htaccess文件重写 RewriteRule ^index\.php$ - [L]
- 下一篇:php中include引入一个页面的时候为什么用dirname(__FILE__) ?
-
2014-06-13onmouseout 等一系列事件的用法简单举例 .
-
2023-04-06Vue中 Vue.prototype使用详解
-
2023-09-24php input()
-
2012-10-07解析关键词排名不稳定的十大原因
-
2020-08-04创业想做电商运营必须注意的细节问题
-
2013-06-10详解SQL Server数据库索引
