我的 mod_rewrite 规则是错误的,我似乎不知道如何编写它来为我工作

发布于 2024-09-28 08:37:48 字数 698 浏览 1 评论 0原文

这是我当前的 .htaccess 文件: (它在我的个人 WAMP 服务器上运行。并且 Mod_Rewrite 在我的服务器上启用。)

<IfModule mod_rewrite.c>
   Options +FollowSymLinks
   Options +Indexes
   RewriteEngine On
   RewriteBase /rdypages/

   RewriteCond %{SCRIPT_FILENAME} !-f
   RewriteCond %{SCRIPT_FILENAME} !-d
   RewriteRule ^(.*)$ /rdypages/index.php?company=$1&page=$2
</IfModule>

我的 /rdypages/index.php 文件旨在在 quesystring 中查找以下参数: 公司和页面。这是一个示例地址:

http://localhost:8888/rdypages/index.php?company=test&page=test.htm

这就是我希望它看起来像的样子:

http://localhost:8888/rdypages/test/test.htm

我的 .htaccess 文件的 RewriteRule 应该说什么? 谢谢

Here is my current .htaccess file:
(it is running on my personal WAMP server. And Mod_Rewrite is enable on my server.)

<IfModule mod_rewrite.c>
   Options +FollowSymLinks
   Options +Indexes
   RewriteEngine On
   RewriteBase /rdypages/

   RewriteCond %{SCRIPT_FILENAME} !-f
   RewriteCond %{SCRIPT_FILENAME} !-d
   RewriteRule ^(.*)$ /rdypages/index.php?company=$1&page=$2
</IfModule>

My /rdypages/index.php file is design to look for the following parameters in the quesystring:
company and page. Here is an example address:

http://localhost:8888/rdypages/index.php?company=test&page=test.htm

and this is what I would like it to look like:

http://localhost:8888/rdypages/test/test.htm

What should my .htaccess file's RewriteRule say?
Thanks

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

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

发布评论

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

评论(1

审判长 2024-10-05 08:37:48

我想通了:

RewriteRule ^(.*)/(.*)$ /rdypages/index.php?company=$1&page=$2

我已经测试过它并且工作正常!

i figured it out:

RewriteRule ^(.*)/(.*)$ /rdypages/index.php?company=$1&page=$2

I have tested it and it works fine!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文