Creating simple URL's (.htaccess - mod_rewrite)

前端 未结 1 830
你的背包
你的背包 2021-01-25 10:49

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

I am looking to convert it to: www.domain.com/page/ - using mod_rewrite..any ideas on that? I read through some

1条回答
  •  失恋的感觉
    2021-01-25 11:16

    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 讨论(0)
提交回复
热议问题