.htaccess 查询字符串url的htaccess重写规则

.htaccess 查询字符串url的htaccess重写规则,.htaccess,.htaccess,我只是对一个网站做了一个巨大的改造,并改变了框架。因此,URL的结构发生了变化。这不是一个大问题,除了一个经常使用的url。我需要将用户从旧地址重定向到新地址,但我不知道该怎么做 旧url:domain/?page/subpage/subsubpage.html?参数=[参数]/ 新url:domain/controller/function/[参数]/ 我当前的重写规则如下: RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST

我只是对一个网站做了一个巨大的改造,并改变了框架。因此,URL的结构发生了变化。这不是一个大问题,除了一个经常使用的url。我需要将用户从旧地址重定向到新地址,但我不知道该怎么做

  • 旧url:domain/?page/subpage/subsubpage.html?参数=[参数]/
  • 新url:domain/controller/function/[参数]/
我当前的重写规则如下:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule .* index.php/$0 [L]
RewriteRule ^/\?page/subpage/subsubpage.html\?param=(.*)$ /controller/function/$1 [L]
但它不起作用,没有重定向发生

编辑:添加了整个htaccess文件!这当前给了我错误500(“由于可能的配置错误,请求超过了10个内部重定向的限制。”)

Options+FollowSymLinks
重新启动发动机
重写基/
命令拒绝,允许
全盘否定
#允许资产文件夹通过
重写规则^(燃料/模块/(.+)?/资产/(.+)-[L]
重写规则^(燃料/模块/(.+)?/tuki/(.+)-[L]
重写规则^(燃料/模块/(.+)?/wiki/(.+)-[L]
#保护应用程序和系统文件不被查看
重写规则^(燃料/安装/+|燃料/克隆/+|燃料/数据|备份/+|燃料/代码点火器/+|燃料/模块/+|燃料/应用/-[F,L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则^/\?page/subpage/subsubpage.html\?param=(.*)$/controller/function/$1[L]
重写规则。*index.php/$0[L]
#防止访问点文件(.git、.htaccess)-安全性。
重写cond%{SCRIPT_FILENAME}-d
重写cond%{SCRIPT_FILENAME}-f
重写规则“(^ |/)\”-[F]
选项-索引

对于所显示的示例/尝试,请尝试以下内容。 请确保在测试URL之前清除浏览器缓存

Options +FollowSymLinks
Options -Indexes
<IfModule mod_rewrite.c>
RewriteEngine ON
RewriteBase /

<Files .*>
Order Deny,Allow
Deny From All
</Files>

# Prevents access to dot files (.git, .htaccess) - security.
RewriteRule \.(git|htaccess) - [F]

# Allow asset folders through
RewriteRule ^fuel/modules/(assets|tuki|wiki) - [L]

# Protect application and system files from being viewed
RewriteRule ^fuel/(install|crons|data_backup|codeigniter|modules|application)/.+ - [F,L]

##Any non existing directory OR files whose URI srarts from page rule.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/\?page/subpage/subsubpage.html\?param=(.*)$ /controller/function/$1 [L]

####If any non existing directory OR file is requested then come here:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php/$0 [L]
    
###New rule added by me here.....
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
ReWriteCond %{QUERY_STRING} .*=([^/[]*)/?$
RewriteRule ^ controller/function/%1 [L]  
</IfModule>
Options+FollowSymLinks
选项-索引
重新启动发动机
重写基/
命令拒绝,允许
全盘否定
#防止访问点文件(.git、.htaccess)-安全性。
重写规则\(git | htaccess)-[F]
#允许资产文件夹通过
重写规则^燃料/模块/(资产|图基|维基)-[L]
#保护应用程序和系统文件不被查看
重写规则^fuel/(安装| crons |数据|备份| codeigniter |模块|应用程序)/.+-[F,L]
##URI从页面规则中删除的任何不存在的目录或文件。
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则^/\?page/subpage/subsubpage.html\?param=(.*)$/controller/function/$1[L]
####如果请求任何不存在的目录或文件,请访问此处:
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则^index.php/$0[L]
###我在这里添加的新规则。。。。。
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
ReWriteCond%{QUERY_STRING}.*=([^/[]*)/$
重写规则^controller/function/%1[L]

旧url:domain/?page/subpage/subsubpage.html?param=[参数]/
:旧url中是否有
两次?
Options +FollowSymLinks
Options -Indexes
<IfModule mod_rewrite.c>
RewriteEngine ON
RewriteBase /

<Files .*>
Order Deny,Allow
Deny From All
</Files>

# Prevents access to dot files (.git, .htaccess) - security.
RewriteRule \.(git|htaccess) - [F]

# Allow asset folders through
RewriteRule ^fuel/modules/(assets|tuki|wiki) - [L]

# Protect application and system files from being viewed
RewriteRule ^fuel/(install|crons|data_backup|codeigniter|modules|application)/.+ - [F,L]

##Any non existing directory OR files whose URI srarts from page rule.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/\?page/subpage/subsubpage.html\?param=(.*)$ /controller/function/$1 [L]

####If any non existing directory OR file is requested then come here:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php/$0 [L]
    
###New rule added by me here.....
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
ReWriteCond %{QUERY_STRING} .*=([^/[]*)/?$
RewriteRule ^ controller/function/%1 [L]  
</IfModule>