推荐Typecho
typecho去除链接index.php并开启伪静态方法
写在前面
Typecho程序默认永久链接格式是http://www.xxxxx.com/index.php/archives/1/,这样设置对搜索引擎及其不友好,不仅不美观,而且还影响搜索引擎抓取,那么我们要如何实现去掉index.php并实现伪静态呢?废话不多说,跟着凝寒seo往下看。
步骤
1.网站后台--设置-永久链接-启用重写功能
2.修改伪静态文件
windows IIS环境(httpd.ini)
[ISAPI_Rewrite] # 3600 = 1 hour CacheClockRate 3600 RepeatLimit 32 # 中文tag解决 RewriteRule /tag/(.*) /index\.php\?tag=$1 # sitemapxml RewriteRule /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] # feed RewriteRule /feed/(.*) /index.php/feed/$1 [L] # 日期归档 RewriteRule /2(.*) /index.php/2$1 [L] # 上传图片等 RewriteRule /action(.*) /index.php/action$1 [L]
Linux apache环境(.htaccess
)
<IfModule mod_rewrite.c> RewriteEngine On # 下面是在根目录,文件夹要修改路径 RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /index.php/$1 [L] </IfModule>
Nginx环境
server { listen 80; server_name yourdomain.com; root /home/yourdomain/www/; index index.html index.htm index.php; if (!-e $request_filename) { rewrite ^(.*)$ /index.php$1 last; } location ~ .*\.php(\/.*)*$ { include fastcgi.conf; fastcgi_pass 127.0.0.1:9000; } access_log logs/yourdomain.log combined; }
如何看自己的服务器是什么环境?
1.宝塔面板查看
2.站长工具查询(输入域名查询)
写在最后
我的是Apache环境,使用其他环境的自行测试
原创文章,作者:NHSEO,如若转载,请注明出处:http://www.seoyhjc.com/Typecho/weijingtai.html
-- 展开阅读全文 --