.htaccess重定向未定向到指定文件
我在我的一个旧域上有一个.htaccess文件,其中包含的重定向不是我想要的重定向 如果我输入olddomain.com/about-us.html,则重定向会将用户发送到newdomain.com/about-us.html。我尝试的是将用户引导到newdomain.com/about 下面是我的.htaccess文件,其中有一个重定向示例 有人知道我做错了什么吗.htaccess重定向未定向到指定文件,.htaccess,redirect,.htaccess,Redirect,我在我的一个旧域上有一个.htaccess文件,其中包含的重定向不是我想要的重定向 如果我输入olddomain.com/about-us.html,则重定向会将用户发送到newdomain.com/about-us.html。我尝试的是将用户引导到newdomain.com/about 下面是我的.htaccess文件,其中有一个重定向示例 有人知道我做错了什么吗 RewriteEngine On RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.co
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com$ [NC]
RewriteCond %{THE_REQUEST} !/administrator [NC]
RewriteRule /about-us.html https://newdomain.com/about [L,R=301]
Redirect 301 /about-us.html https://newdomain.com/about
RewriteRule ^ https://newdomain.com%{REQUEST_URI} [L,R=301,NE]
网络选项卡:
让它像这样:
RewriteEngine On
RewriteRule ^about-us\.html$ https://newdomain.com/about [L,R=301,NC]
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com$ [NC]
RewriteCond %{THE_REQUEST} !/administrator [NC]
RewriteRule ^ https://newdomain.com%{REQUEST_URI} [L,R=301,NE]
- 请确保在新浏览器中对其进行测试或完全清除浏览器缓存
- 测试时确保.htaccess中没有其他代码
RewriteRule^about us/employees\.html$/something[L,R=301,NC]
我做错了吗?这条特定的线路不工作。我尝试了不同的浏览器<代码>重写规则^about us/t-Slotting-Aluminal-profiles\.html$https://newdomain.com/profile [L,R=301,NC]您的规则最终匹配了.html
,因此您的源URL应该是:https://mbkitsystems.com/about-us/t-slotted-aluminum-profiles.html
完美。谢谢你的帮助!非常感谢。