Apache 重定向301域和某些页面
我需要通过htaccess将我的旧域.com重定向到新域.com 新域具有不同的URLApache 重定向301域和某些页面,apache,.htaccess,redirect,mod-rewrite,seo,Apache,.htaccess,Redirect,Mod Rewrite,Seo,我需要通过htaccess将我的旧域.com重定向到新域.com 新域具有不同的URL old domain.com/aboutus.html至new domain.com/us.html old-domain.com/contact-us.html至new-domain.com/form.html 。。。。。 所有其他页面old-domain.com/xxxxxxxxxx重定向到主页new-domain.com 谢谢假设您使用的是apache http服务器,您需要在http服务器中启用重写
old domain.com/aboutus.html
至new domain.com/us.html
old-domain.com/contact-us.html
至new-domain.com/form.html
。。。。。
所有其他页面old-domain.com/xxxxxxxxxx重定向到主页new-domain.com
谢谢假设您使用的是apache http服务器,您需要在http服务器中启用重写模块,并且需要实现以下重写规则:
RewriteEngine on
RewriteRule ^/?aboutus\.html$ /us.html [R=301,END]
RewriteRule ^/?contact-us\.html$ /form.html [R=301,END]
RewriteRule ^ / [R=301,END]
这些规则可以放在http服务器的主机配置中。如果您无法访问该文件,则必须使用分布式配置文件(“.htaccess”),该文件应放在http主机的
DOCUMENT\u ROOT
文件夹中。请记住,您需要启用此类文件的解释。在这种情况下,请检查apache http服务器文档中的AllowOverride
指令。欢迎使用此指令,请在您的问题中添加您的htaccess规则文件,谢谢。