王尘宇王尘宇

研究百度干SEO做推广变成一个被互联网搞的人

Typecho伪静态划定规矩、301跳转

Typecho伪静态划定规矩、301跳转


一、Apache

<IfModule mod_rewrite.c>RewriteEngine On# 下面是在根目录,文件夹要修正途径,如 /typecho/,同时 RewriteRule 也要随着变RewriteBase /RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule ^(.*)$ /index.php/$1 [L]</IfModule>

外加一个顶级域名和二级域名的跳转

# 带 www 的跳转到不带的RewriteCond %{HTTP_HOST} ^www.weidao.netRewriteRule (.*) http://weidao.net/$1 [R=301,L]# 不带 www 的跳转到带的RewriteCond %{HTTP_HOST} ^weidao.netRewriteRule (.*) http://www.weidao.net/$1 [R=301,L]

注:最新的 SVN 在背景启用重写功用的时刻能自动生成 .htaccess 文件。

二、Nginx

location / {index index.html index.php;if (-f $request_filename/index.html) {rewrite (.*) $1/index.html break;}if (-f $request_filename/index.php) {rewrite (.*) $1/index.php;}if (!-f $request_filename) {rewrite (.*) /index.php;}}

三、SEA

name: typechoversion: 1#cron:# - description: cron test# url: index.php# schedule: every 43 mins# timezone: Beijinghandle:- rewrite: if(!is_dir() && !is_file()) goto "index.php?%{QUERY_STRING}"

四、IIS 下的 httpd.ini

不圆满,可参考修正。

[ISAPI_Rewrite]# 3600 = 1 hourCacheClockRate 3600RepeatLimit 32# 中文tag处理RewriteRule /tag/(.*) /index.php?tag=$1# sitemapxmlRewriteRule /sitemap.xml /sitemap.xml [L]RewriteRule /favicon.ico /favicon.ico [L]# 内容页RewriteRule /(.*).html /index.php/$1.html [L]# 批评RewriteRule /(.*)/comment /index.php/$1/comment [L]# 分类页RewriteRule /category/(.*) /index.php/category/$1 [L]# 分页RewriteRule /page/(.*) /index.php/page/$1 [L]# 搜刮页RewriteRule /search/(.*) /index.php/search/$1 [L]# feedRewriteRule /feed/(.*) /index.php/feed/$1 [L]# 日期归档RewriteRule /2(.*) /index.php/2$1 [L]# 上传图片等RewriteRule /action(.*) /index.php/action$1 [L]

另一个:

[ISAPI_Rewrite]RewriteRule ^/admin(.*) /admin/$1 [L]RewriteRule ^(.*)(html|htm)$ /index\.php/$1$2 [L]RewriteRule ^(1+)$ /index\.php/$1 [L]

第一条 重定向背景地点
第二条 将带html htm 后缀的重写
第三条 消除带"."的 其他的悉数重写

而下面这个好像是WP的,只做参考用

[ISAPI_Rewrite]# 3600 = 1 hourCacheClockRate 3600RepeatLimit 32# Protect httpd.ini and httpd.parse.errors files# from accessing through HTTP# Rules to ensure that normal content gets throughRewriteRule /sitemap.xml /sitemap.xml [L]RewriteRule /favicon.ico /favicon.ico [L]# For file-based wordpress content (i.e. theme), admin, etc.RewriteRule /wp-(.*) /wp-$1 [L]# For normal wordpress content, via index.phpRewriteRule ^/$ /index.php [L]RewriteRule /(.*) /index.php/$1 [L]

注:记获得背景永远链接设置里,启用地点重写功用。


上一篇: 什么是seo技术

相关文章

评论列表

发表评论:
验证码

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。