我的htacess

写这个博客的时间也不短了,一直没有修改htaccess,今天又修改了一次

这是我的

# WordPress开始
<IfModule mod_rewrite.c>
RewriteEngine on

RewriteBase /
#
#如果这个请求是针对“/”或者是已经写入到WP中了
RewriteCond $1 ^(index\.php)?$ [OR]
#或者如果这个请求是针对image, css, 或js文件
RewriteCond $1 \.(gif|jpg|css|js|ico)$ [NC,OR]
#如果URL指向存在的文件
RewriteCond %{REQUEST_FILENAME} -f [OR]
#如果URL指向了存在的目录
RewriteCond %{REQUEST_FILENAME} -d
# 那么跳过重写直接到WP
RewriteRule ^(.*)$ - [S=1]
#否则指向WP重写该请求
RewriteRule . /index.php [L]

#保护.htaccess自身
<files .htaccess>
order allow,deny
deny from all
</files>

# limit file uploads to 10mb限制上传文件大小10M
LimitRequestBody 10240000

#隐藏服务器的数字签名
ServerSignature Off

#保护wp-config.php
<files wp-config.php>
order allow,deny
deny from all
</files>
#防止index文件不存在而列出所有文件
# disable directory browsing
Options All -Indexes
# set the canonical url  301定向
RewriteCond %{HTTP_HOST} ^5169\.info$ [NC]
RewriteRule ^(.*)$ http://www.5169.info/$1 [R=301,L]

#disable hotlinking of images 防图片盗链
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?5169.info/.*$ [NC]
#RewriteRule \.(gif|jpg|png)$ http://www.5169.info/stealingisbad.gif [R,L]
#
</IfModule>
#WordPress结束

版权声明:
作者:xinyu2ru
链接:https://www.rxx0.com/software/my-htacess.html
来源:RUBLOG-分享我的生活
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
< <上一篇
下一篇>>