我有一个电子表格,其中包含404错误链接列及其相应的301重定向。
I have spreadsheet which has column of 404 error link and its respective 301 redirects. for e.g)
404 error page 301 redirect www.abc/1.php www.abc/com/2.php .............. ............该电子表格具有大约1000多个链接。
The spreadsheet has around 1000+ links.
apache config或htaccess中有什么办法可以处理批量301重定向?
Is there any way in apache config or htaccess where can I handle bulk 301 redirects?
推荐答案批量设置的最佳方法是 RewriteMap 指令在mod-rewrite中。请注意,这不适用于.htaccess文件。您需要在真实的apache配置文件中对其进行编辑(而且好消息是它确实比.htaccess动态配置要快)。
The best way for a Bulk setting is the RewriteMap directive in mod-rewrite. Note that this will not work in a .htaccess file. You'll need to edit it in a real apache configuration file (and the good news is that will be really faster than a .htaccess dynamic configuration).
检查 txt:关键字。
可能是这样的:
RewriteMap myredirects txt:/path/to/my/txt/map.txt RewriteCond ${myredirects:$1} ^/.+ RewriteRule ^(.+)$ %0 [R=302]当您可以正常使用时,请转换301中的302,然后使用 dbm:关键字(和 httxt2dbm 命令将txt文件转换为更快的哈希图,但这在链接的文档中有解释。)
When you'll get it working well transform the 302 in 301, and convert the txt file to an faster hashmap with the dbm: keyword (and a httxt2dbm command, but that's explained in the linked doc).
更多推荐
从htaccess批量301重定向
发布评论