的.htaccess平链接url可缩短 [英] .htaccess flat links url shorten

查看:243
本文介绍了的.htaccess平链接url可缩短的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个域owp.me,我想用htaccess的,这样我可以转换成以下。

I have a domain owp.me and I want to use htaccess so that I can convert to following.

http://owp.me/id?=0f49 到的 http://owp.me/0f49

标识将只接受A-Z,A-Z,0-9

The "id" will only accept A-Z, a-z, 0-9

我将如何建立重写重写规则?

How would I set up the rewrite the RewriteRule?

编辑:

我发现怎么办 http://owp.me/hi/0f49

Options +FollowSymlinks
RewriteEngine on
RewriteRule ^hi/([^/]+) /index.php?id=$1 [NC]

但看不到如何删除了喜,并使其正常工作。

but can't see how to remove the "hi" and make it work properly.

推荐答案

找到了答案。一把抓起YOURLS .htaccess文件(HTTP://$c$c.google.com/p/yourls/)

Found the answer. Grabbed the .htaccess file from Yourls (http://code.google.com/p/yourls/)

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([0-9A-Za-z]+)/?$ /index.php?id=$1 [L]
</IfModule>

希望这可以帮助别人。

Hope this helps someone else.

这篇关于的.htaccess平链接url可缩短的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆