.htaccess htaccess问题与url重写

.htaccess htaccess问题与url重写,.htaccess,.htaccess,这是我的htaccess文件: Options -Multiviews RewriteEngine on RewriteBase / RewriteRule ^index.php$ / [L,R=301] RewriteRule ^(.+)/index.php$ /$1/ [L,R=301] 这已成功删除index.php,但离开了吗?在查询字符串之前 http://example.com/?type=1 如何使用htaccess删除此“?” 此外,我如何实际将上述url显示为: htt

这是我的htaccess文件:

Options -Multiviews

RewriteEngine on
RewriteBase /

RewriteRule ^index.php$ / [L,R=301]
RewriteRule ^(.+)/index.php$ /$1/ [L,R=301]
这已成功删除index.php,但离开了吗?在查询字符串之前

http://example.com/?type=1
如何使用htaccess删除此“?”

此外,我如何实际将上述url显示为:

http://example.com/type/1
尝试以下方法

RewriteEngine On
RewriteRule ^type/([^/]*)$ /index.php?type=$1 [L]
它的工作原理

RewriteRule^type/([^/]+)/?$
意味着它正在将您的路径的URL设置为
type/5*/
*=放入其中的任何数字

然后,新url中给出的信息将传递给索引页面。(
index.php?type=$1[L]

例如,如果您有type/1,它会将其转发到index.php?type=1


我希望这有助于您和您现在更广泛地了解它的工作原理。

下面是我的.htaccess
RewriteEngine on
RewriteRule ^type/([^/.]+)/?$ index.php?type=$1 [L]