带条件的掩码URL

时间:2019-05-22 09:11:29

标签: php .htaccess server

我试图屏蔽我的网站URL,以删除文件名,并隔离该变量在URL中传递并通过'GET'获取的关键元素。

我已经能够删除.php,但无法删除整个文件名来隔离获取的变量。

是否可以屏蔽文件但保留URL?当然只是被用户隐藏了。

RewriteOptions inherit
RewriteEngine On  # enables url rewriting

RewriteCond %{REQUEST_FILENAME} !-d  # if requested uri is not directory (!-d)
RewriteCond %{REQUEST_FILENAME}\.php -f # and if there is a file named URI+'.php' (-f)
RewriteRule ^(.*)$ $1.php # then if there is any thing in uri then rewrite it as uri+'.php'

预期(理想):

example.com/dir/file.php?id=BRAND

实际

example.com/dir/?id=BRAND

0 个答案:

没有答案