创建简单的URL(的.htaccess - mod_rewrite的) [英] Creating simple URL's (.htaccess - mod_rewrite)

查看:193
本文介绍了创建简单的URL(的.htaccess - mod_rewrite的)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这样的结构,我的导航的index.php?V =页

I have this structure for my navigation index.php?v=page

我期待将其转换为:www.domain.com/page/ - 使用上mod_rewrite..any的想法?我通过一些TUTS和实例阅读,但不可能获得工作的权利。

I am looking to convert it to: www.domain.com/page/ - using mod_rewrite..any ideas on that? I read through some tuts and examples, but couldnt get it working right.

推荐答案

下面是一些例子。

RewriteEngine on

# www.domain.com/page/example changed to index.php?page=example
RewriteRule ^page/([^/\.]+)/?$ index.php?page=$1 [L]

# www.domain.com/example changed to index.php?v=example
RewriteRule ^example(/)?$ index.php?v=example [L]

第二条规则听起来像是你追求的是什么。

The second rule sounds like what you're after.

这篇关于创建简单的URL(的.htaccess - mod_rewrite的)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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