开发者

Creating simple URL's (.htaccess - mod_rewrite)

开发者 https://www.devze.com 2022-12-24 00:16 出处:网络
I have this structure for my navigation index.php?v=p开发者_如何学运维age I am looking to convert it to: www.domain.com/page/ - using mod_rewrite..any ideas on that? I read through some tuts and exam

I have this structure for my navigation index.php?v=p开发者_如何学运维age

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.


Here's some examples.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消