1

我想将子目录中的所有文件重定向到它们的新根 URL。

旧网址是

www.domain.com/subdirectory/filename-here.html

新位置是

www.domain.com/filename.here.html

旧 URL 已在 Google 中列出,需要对这些 URL 进行某种重定向。我确定 htaccess 是去这里的方式,但不确定解决方案。

4

1 回答 1

1
RewriteEngine on
RewriteRule %{REQUEST_URI} ^/subdirectory/.*
RewriteRule subdirectory/(.*)$ /$1 [R=301,L]

在这里测试。如果它不起作用 - 以[^/]这种方式添加屏蔽:[^\/]

于 2013-03-04T19:57:54.137 回答