htaccess mod_rewrite part of url to GET variable

后端 未结 2 723
再見小時候
再見小時候 2020-12-18 12:24

I have some URLs like these:

  • http://plutov.by/post/cubique_zf_jquery
  • http://plutov.by/post/mysql_useful_queries
2条回答
  •  温柔的废话
    2020-12-18 12:49

    You can use something like this in your .htaccess:

    RewriteRule ^post/(.*)$ post/main?title=$1 [L]
    

    You should keep this rule BEFORE one entry point rewriting rules. If rule will trigger then rewrite rule lookup will be finished (since [L] option specified)

    Some modification of paths may be required if you want to use these rules in VirtualHost context

提交回复
热议问题