Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache 如何将参数发送到子索引页?_Apache_Indexing_Friendly Url - Fatal编程技术网

Apache 如何将参数发送到子索引页?

Apache 如何将参数发送到子索引页?,apache,indexing,friendly-url,Apache,Indexing,Friendly Url,我有一个主页,例如:www.example.com 有这样一个url: www.example.com/subdirectory/page.php?var1=A&var2=B 这是一个很长的url,因此我将其更改为: www.example.com/subdirectory/page/A/B 以及配置.htaccess文件: ForceType应用程序/x-httpd-php 然而,我认为它也相当长。如果page.php更改为index.php,页面似乎会消失,如下所示: www.example

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

有这样一个url:

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

这是一个很长的url,因此我将其更改为:

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

以及配置.htaccess文件:

ForceType应用程序/x-httpd-php

然而,我认为它也相当长。如果page.php更改为index.php,页面似乎会消失,如下所示:

www.example.com/subdirectory/A/B

但我不知道如何实现

是否可以省略“第页”?我怎么能这么做呢


谢谢您的帮助。

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

Chris,您说得对。但是,如果使用mod_rewrite,则是“重定向”。我仍然有一个很长的url。我不认为这是一个友好的搜索引擎优化网址。实际上,使用我上面写的.htaccess,您可以得到一个更短的url,也可以被搜索引擎检测到。谢谢你的回答。