Commit 5658f9a1 authored by whzecomjm's avatar whzecomjm
Browse files

update copyleft, add 301,md

parent 8e341214
Loading
Loading
Loading
Loading

html-css/301.md

0 → 100644
+43 −0
Original line number Diff line number Diff line
# 301的几种实现方式

我最近把主页部署在不同地方,如Github, CNPaaS。但是问题是他们都不支持.htaccess。经过一番查找收集,常用的301跳转的几种实现方式如下。

## Apache 服务器

使用.htaccess,放在public根目录中,代码如下:

```
RewriteEngine On
RewriteBase /
Redirect permanent /cn http://cn.whzecomjm.com/
Redirect permanent /en http://en.whzecomjm.com/
```

## nginx 服务器

修改 nginx.conf,在 CNPaaS 或者 Openshift 的部署方式中,在 .openshift 文件夹中有文件 nginx.conf.erb。在 `server {}` 内加入如下代码即可:

```
  if ( $request_filename ~ cn/ ) {
    rewrite ^ http://cn.whzecomjm.com/? permanent;
  }
  if ( $request_filename ~ en/ ) {
    rewrite ^ http://en.whzecomjm.com/? permanent;
  }
  error_page  404  /404.html;
```

## Github Pages

Github Pages不支持上述文件,可以在index.html(最好404文件也加上)的头部`<head>``</head>`之间加入如下代码:

```
<script language="javascript" type="text/javascript">
if (location.href == "http://whzecomjm.com/cn/") {
	window.location.replace("http://cn.whzecomjm.com/");
};
if (location.href == "http://whzecomjm.com/en/") {
	window.location.replace("http://en.whzecomjm.com/");
}
</script>
```
 No newline at end of file

html-css/copyleft.html

deleted100644 → 0
+0 −17
Original line number Diff line number Diff line
<style>
  .copy-left {
     display: inline-block;
     text-align: right;
     margin: 0;
    -moz-transform: scaleX(-1);
    -o-transform: scaleX(-1);
    -webkit-transform: scaleX(-1);
    transform: scaleX(-1);
    filter: FlipH;
    -ms-filter: "FlipH";
  }
</style>

<p><span class="copy-left">&copy;</span><span>&nbsp;Copyleft</span></p>

// This makes the "Copyleft symbol." Credit to the Stack Overflow user "Anonimo" for the help on the CSS <http://stackoverflow.com/users/2178220/anonimo>
 No newline at end of file

html-css/copyleft.md

0 → 100644
+21 −0
Original line number Diff line number Diff line
# Copyleft 符号

利用 js 把版权符号旋转180度即可(参考[Copyleft](https://gist.github.com/JGallardo/6077195)),实现方法:

```
    <style>
    .copy-left {
        display: inline-block;
        text-align: right;
        margin: 0;
        -moz-transform: scaleX(-1);
        -o-transform: scaleX(-1);
        -webkit-transform: scaleX(-1);
        transform: scaleX(-1);
        filter: FlipH;
        -ms-filter: "FlipH";
    }
    </style>
 
    <p><span class="copy-left">&copy;</span><span>&nbsp;Copyleft</span></p>
```