.htaccess - 从URL中删除所有参数

时间:2016-02-28 11:28:17

标签: php .htaccess

我需要从地址中删除所有GET个参数,我试过这样的想法:

<IfModule mod_rewrite.c>

RewriteEngine on
RewriteRule ^index.php/([^/]+)/?([^/]*) /index.php?url=$1&ip=$2&category=$3 [NC]

</IfModule>

<IfModule !mod_rewrite.c>
    ErrorDocument 404 /index.php
</IfModule>

但它不起作用......

我需要重定向:

http://example.com/folder/index.php?url=google.com&ip=10.0.0.0&category=website

http://example.com/folder

但保留参数数据 - 我需要通过$_GET['parameter']获取数据。

1 个答案:

答案 0 :(得分:3)

您可以将http://example.com/folder映射到http://example.com/folder/index.php?url=google.com&ip=10.0.0.0&category=website,但是您无法传递不同的查询字符串参数。

如果您想通过网址传递数据,那么数据必须显示在网址中。

相关问题