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;
}
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;
}
2014-6-23 21:42 火星人
太感谢了,十分有用。
2014-4-17 18:08 冬
不错,收藏
2013-1-17 11:30 大嘴鸭
学习了,正需要呢
2012-4-19 09:57 短
请教一下博主,httpd.ini的规则是怎样的呢,能不能指点一下
碟舞飞扬 回复于 2012-4-21 15:28
已经发到你留言时填写的邮箱,由于没有windows平台所以未测试。
分页: 1/1 1