千万个美丽的未来,抵不上一个温暖的现在,每一个真实的现在,都是我们曾经幻想的未来!
分页: 1/1 第一页 1 最后页 [ 显示模式: 摘要 | 列表 ]
Mar 12
一、Apache YOURLS Rewrite规则
1、安装在根目录下:

# BEGIN YOURLS

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /yourls-loader.php [L]

# END YOURLS

2、安装在子目录下

# BEGIN YOURLS

RewriteEngine On
RewriteBase /somedir/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /somedir/yourls-loader.php [L]

# END YOURLS

3、使用非带www的域名

# BEGIN WithoutWWW
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.yourls\.org$ [NC]
RewriteRule ^(.*)$ http://yourls.org/$1 [R=301,L]
# END WithoutWWW

二、Nginx YOURLS Rewrite规则
1、安装在根目录下

location /
{
if (!-f $request_filename){
        set $rule_0 1$rule_0;
}
if (!-d $request_filename){
        set $rule_0 2$rule_0;
}
if ($rule_0 = "21"){
        rewrite ^/([0-9A-Za-z]+)/?$ /yourls-go.php?id=$1 last;
}
        rewrite ^/([0-9A-Za-z]+)\+/?$ /yourls-infos.php?id=$1 last;
        rewrite ^/([0-9A-Za-z]+)\+all/?$ /yourls-infos.php?id=$1&all=1 last;
}

2、安装在子目录下

location /dir/
{
if (!-f $request_filename){
       set $rule_0 1$rule_0;
}
if (!-d $request_filename){
       set $rule_0 2$rule_0;
}
if ($rule_0 = "21"){
    rewrite ^/dir/([0-9A-Za-z]+)/?$ /url/yourls-go.php?id=$1 last;
}
    rewrite ^/dir/([0-9A-Za-z]+)\+/?$ /url/yourls-infos.php?id=$1 last;
    rewrite ^/dir/([0-9A-Za-z]+)\+all/?$ /url/yourls-infos.php?id=$1&all=1 last;
}
Tags: , , ,
分页: 1/1 第一页 1 最后页 [ 显示模式: 摘要 | 列表 ]