URL的htaccess的mod_rewrite的一部分GET变量

问题描述:

我有这样的一些网址:

  • http://plutov.by/post/cubique_zf_jquery
  • http://plutov.by/post/mysql_useful_queries
  • http://plutov.by/post/cubique_zf_jquery
  • http://plutov.by/post/mysql_useful_queries

我如何使用Apache的mod_rewrite的帮助下打开下一个页面?

How can I with help of Apache mod_rewrite open the next pages?

  • http://plutov.by/post/main?title=cubique_zf_jquery
  • http://plutov.by/post/main?title=mysql_useful_queries
  • http://plutov.by/post/main?title=cubique_zf_jquery
  • http://plutov.by/post/main?title=mysql_useful_queries

此外,将与一个入口点重写?

Also, will be this new rewrite rule work with "one entry point rewriting"?

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]

感谢。

为了与一个入口点重写的新重写规则的工作,有你的的规则集这样的

To make the new rewrite rule work with "one entry point rewriting", have your rewriteRules like this:

QSA 标志的必须的作为要添加一个新的查询字符串。

The QSA flag is mandatory as you are adding a new query string.

RewriteEngine On

RewriteRule ^(post)/([\w\d\-]+)/?$ $1/main?title=$2 [QSA]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule . index.php [L]

  • 标志 QSA Apache的文档
  • ! - 。→检查所请求的URI是不是象征性的油墨
    • Flag QSA Apache Docs.
    • !-l checks that the requested URI is not a symbolic ink.