如何向子索引页面发送参数?
我有一个主页,例如: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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我建议使用 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.