MOD_rewrite 从静态 URL 到动态 URL

发布于 2024-08-27 17:06:02 字数 1587 浏览 2 评论 0原文

我有以下正确的网址...

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> 

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

I have the following URL which is correct...

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

but i need it to render this page:

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

This is my current .htaccess which serves other pages correctly already. I want to add something to manage this other rule. I had an attempt where you can cask-beer

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> 

Any help would be appreciated.
Cheers

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

雾里花 2024-09-03 17:06:02

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

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

Just add this rule at the top of your other rules:

RewriteRule ^cask-beer/wells-and-youngs$ cask-beer?catID=4 [L,QSA]
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文