301 将整个目录重定向到特定的 thread/link(同一域)
301 redirect a whole directory to a specific thread/link (same domain)
我想将 301 重定向添加到整个目录,并将该目录的每个 link 重定向到同一域中的特定 thread/post。
我正在使用 apache 服务器,所以我想我将不得不编辑 .htaccess
我想要这个目录的所有线程:
要重定向到那里:
http://example.com/f75/newthread-1990/#post333
我阅读了一些不同的解决方案并感到困惑:(
- 有些人推荐使用 "Redirect" 命令,其他人推荐使用 "RedirectMatch" 命令...
- 我还读到如果 .htaccess 已经被编辑并且有一些重写规则,命令应该不同。不确定它是否有意义或我是否误解了,但目前我已将以下行添加到 .htaccess:
RewriteCond %{HTTP_HOST} ^www.example.com [NC]
重写规则 ^(.*)$ htt://example.com/$1 [L,R=301]
您可以在根 .htaccess 中使用此规则:
RewriteEngine On
RewriteRule ^f73 /f75/newthread-1990/#post333 [L,NC,NE,R=301]
我想将 301 重定向添加到整个目录,并将该目录的每个 link 重定向到同一域中的特定 thread/post。 我正在使用 apache 服务器,所以我想我将不得不编辑 .htaccess
我想要这个目录的所有线程:
要重定向到那里:
http://example.com/f75/newthread-1990/#post333
我阅读了一些不同的解决方案并感到困惑:(
- 有些人推荐使用 "Redirect" 命令,其他人推荐使用 "RedirectMatch" 命令...
- 我还读到如果 .htaccess 已经被编辑并且有一些重写规则,命令应该不同。不确定它是否有意义或我是否误解了,但目前我已将以下行添加到 .htaccess: RewriteCond %{HTTP_HOST} ^www.example.com [NC] 重写规则 ^(.*)$ htt://example.com/$1 [L,R=301]
您可以在根 .htaccess 中使用此规则:
RewriteEngine On
RewriteRule ^f73 /f75/newthread-1990/#post333 [L,NC,NE,R=301]