简体   繁体   English

htaccess仅重定向主目录

[英]htaccess redirect only main directory

I have a list of around 800 single redirects, the .htaccess file is in my subdomain directory. 我有大约800个单重定向的列表,.htaccess文件在我的子域目录中。

I'm using the syntax: Redirect 301 oldURL newURL 我正在使用语法: Redirect 301 oldURL newURL

I need to do this redirect: 我需要执行此重定向:

http://testsub.example.com/en >>> http://www.example.com/page/ http://testsub.example.com/en >>> http://www.example.com/page/

Using this string 使用这个字符串

Redirect 301 /en http://www.example.com/page/

All the other url using the same structure are affected, causing errors. 使用相同结构的所有其他URL均会受到影响,从而导致错误。

Thanks 谢谢

I've solved using 我已经解决了

RewriteRule ^$ https://www.example.com/page/ [R=301,L]

Thanks 谢谢

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM