创建简单的URL(的.htaccess - mod_rewrite的)简单、URL、mod_rewrite、htaccess

2023-09-02 11:40:16 作者:声声慢

我有这样的结构,我的导航的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.