如何向子索引页面发送参数?

发布于 2024-09-01 06:11:24 字数 645 浏览 8 评论 0原文

我有一个主页,例如:www.example.com

有一个这样的网址:

www.example.com/subdirectory/page.php?var1=A&var2=B

这是一个很长的网址,所以我将其更改为:

www.example.com/subdirectory/page.php?var1=A&var2=B example.com/subdirectory/page/A/B

以及我配置 .htaccess 文件:

<文件页面>

ForceType application/x-httpd-php

但是,我认为它也很长。如果“page.php”更改为“index.php”,“页面”似乎消失了,就像这样:

www.example.com/subdirectory/A/B

但我不知道如何实现。

可以省略'page'吗?我怎样才能做到呢?

感谢您的帮助。

I have a homepage, for example: www.example.com.

There is a url like this:

www.example.com/subdirectory/page.php?var1=A&var2=B

It's a long url, so I changed it like this:

www.example.com/subdirectory/page/A/B

as well as I config the .htaccess file:

<Files page>

ForceType application/x-httpd-php

</Files>

However, I assume it's also quite long. If the "page.php" change to "index.php", the "page" seems to disappear, just like this:

www.example.com/subdirectory/A/B

But I don't know how to achieve.

Is omitted 'page' possible? How can I just do it?

Thanks for your help.

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

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

发布评论

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

评论(1

归途 2024-09-08 06:11:24

我建议使用 mod_rewrite 。它将允许您向用户呈现一个漂亮的 URL,然后在 Apache 中重写它。您可以在所有页面上使用 www.example.com/subdirectory/page/A/B ,然后在内部将其重写为 www.example.com/subdirectory/page.php?var1=A&var2=B 。

I would recommend using mod_rewrite for this. It will allow you to present a pretty URL to users and then rewrite it in Apache. You could use www.example.com/subdirectory/page/A/B on all pages and then rewrite it to www.example.com/subdirectory/page.php?var1=A&var2=B internally.

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