最初,我有一个网址为https://schoolname.edu.hk/path/?parameter=value
的网页现在,我想获得以下场景: 当用户访问网址https://schoolname.edu.hk/?parameter=value时,我想重定向到上面的网址
我试图像这样设置.htaccess:
#RewriteEngine on
#RewriteBase /
#RewriteCond %{HTTP_HOST} schoolname.edu.hk [NC]
#RewriteRule ^(.*)$ https://schoolname.edu.hk/path/$1 [R=301,NC]
网址已成功更改。但是,CSS和Image文件等资源都无法加载。
答案 0 :(得分:0)
排除静态内容被重写,在重写规则之前添加以下条件:
RewriteCond %{REQUEST_URI} !^.*\.(jpg|css|js|gif|png)$ [NC]