MOD_rewrite从静态到动态URL

时间:2010-04-02 18:54:53

标签: mod-rewrite

我有以下网址,这是正确的......

http://www.mydomain.co.uk/cask-beer/wells-and-youngs

但我需要它来呈现此页面:

http://www.mydomain.co.uk/cask-beer?catID=4

这是我目前已正确提供其他页面的.htaccess。我想添加一些东西来管理这个其他规则。我有一个尝试,你可以喝啤酒

php_flag magic_quotes_gpc off
AddDefaultCharset UTF-8
Options -Indexes +FollowSymLinks

#
# Setting rewrite rules
#

<IfModule mod_rewrite.c>
  RewriteEngine On
  # Set next line to your Wolf CMS root - if not in subdir, then just /
  RewriteBase /

  # Rules to allow install sequence to test for mod_rewrite support
  RewriteRule ^install/index.html$ install/index.php?rewrite=1 [L,QSA]
  RewriteRule ^install/index.php$ install/index.php?rewrite=1 [L,QSA]
  RewriteRule ^install/$ install/index.php?rewrite=1 [L,QSA]

  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-l
  # Administration URL rewriting.
  RewriteRule ^admin(.*)$ admin/index.php?$1 [L,QSA]

  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-l
  # Main URL rewriting.
  RewriteRule ^(.*)$ index.php?WOLFPAGE=$1 [L,QSA]

  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-l  

  RewriteRule ^(.*)$ index.php?cask-beer?$1

</IfModule> 

任何帮助将不胜感激。 干杯

1 个答案:

答案 0 :(得分:1)

只需将此规则添加到其他规则的顶部:

RewriteRule ^cask-beer/wells-and-youngs$ cask-beer?catID=4 [L,QSA]