2017-09-14 107 views
1

我有一个WordPress的网站,不同的302个重定向,我想改变这些链接从302重定向到301海量链接皈依从302到301

我有或多或少的联系160,所以我需要找到一个巨大的方式来做到这一点。有可能吗?

我可以用这个

# BEGIN 301 Redirects 
Redirect 301 /wp/old-page/ http://www.testdomain.com/wp/new-page/ 
# END 301 Redirects 

但在这种情况下,我应该将所有的环节一一这是不是真的很快。

这是我的.htaccess文件:

# BEGIN WpFastestCache 
<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase/
RewriteCond %{HTTPS} !=on 
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] 
# Start WPFC Exclude 
# End WPFC Exclude 
RewriteCond %{HTTP_USER_AGENT} !(facebookexternalhit|WhatsApp|Mediatoolkitbot) 
RewriteCond %{REQUEST_METHOD} !POST 
RewriteCond %{REQUEST_URI} !(\/){2}$ 
RewriteCond %{REQUEST_URI} \/$ 
RewriteCond %{QUERY_STRING} !.+ 
RewriteCond %{HTTP:Cookie} !(comment_author_|wordpress_logged_in|wp_woocommerce_session) 
RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC] 
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/all/$1/index.html -f [or] 
RewriteCond /home/abbeyse1/public_html/wp-content/cache/all/$1/index.html -f 
RewriteRule ^(.*) "/wp-content/cache/all/$1/index.html" [L] 
</IfModule> 
<FilesMatch "\.(html|htm)$"> 
AddDefaultCharset UTF-8 
<ifModule mod_headers.c> 
FileETag None 
Header unset ETag 
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate" 
Header set Pragma "no-cache" 
Header set Expires "Mon, 29 Oct 1923 20:30:00 GMT" 
</ifModule> 
</FilesMatch> 
# END WpFastestCache 
# BEGIN GzipWpFastestCache 
<IfModule mod_deflate.c> 
AddType x-font/woff .woff 
AddOutputFilterByType DEFLATE image/svg+xml 
AddOutputFilterByType DEFLATE text/plain 
AddOutputFilterByType DEFLATE text/html 
AddOutputFilterByType DEFLATE text/xml 
AddOutputFilterByType DEFLATE text/css 
AddOutputFilterByType DEFLATE text/javascript 
AddOutputFilterByType DEFLATE application/xml 
AddOutputFilterByType DEFLATE application/xhtml+xml 
AddOutputFilterByType DEFLATE application/rss+xml 
AddOutputFilterByType DEFLATE application/javascript 
AddOutputFilterByType DEFLATE application/x-javascript 
AddOutputFilterByType DEFLATE application/x-font-ttf 
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject 
AddOutputFilterByType DEFLATE font/opentype font/ttf font/eot font/otf 
</IfModule> 
# END GzipWpFastestCache 
# BEGIN LBCWpFastestCache 
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf|x-html|css|xml|js|woff|woff2|ttf|svg|eot)(\.gz)?$"> 
<IfModule mod_expires.c> 
ExpiresActive On 
ExpiresDefault A0 
ExpiresByType image/gif A2592000 
ExpiresByType image/png A2592000 
ExpiresByType image/jpg A2592000 
ExpiresByType image/jpeg A2592000 
ExpiresByType image/ico A2592000 
ExpiresByType image/svg+xml A2592000 
ExpiresByType text/css A2592000 
ExpiresByType text/javascript A2592000 
ExpiresByType application/javascript A2592000 
ExpiresByType application/x-javascript A2592000 
</IfModule> 
<IfModule mod_headers.c> 
Header set Expires "max-age=2592000, public" 
Header unset ETag 
Header set Connection keep-alive 
FileETag None 
</IfModule> 
</FilesMatch> 
# END LBCWpFastestCache 
suPHP_ConfigPath /home/abbeyse1/public_html 


Options +FollowSymLinks 
# BEGIN WordPress 
<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase/
RewriteRule ^index\.php$ - [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . /index.php [L] 
</IfModule> 

# END WordPress 

这里的第一链接的列表:

Redirect 301 /seal-manufacturing/rod-piston-bearing-rings/titel-197/ https://abbeyseals.ie/seal-manufacturing/rod-piston-bearing-rings/ 

Redirect 301 /seal-manufacturing/rotary-seals/dr113-2/ https://abbeyseals.ie/seal-manufacturing/rotary-seals/ 

Redirect 301 /seal-manufacturing/rod-seals/titel-164/ https://abbeyseals.ie/seal-manufacturing/rod-seals/ 

Redirect 301 /seal-manufacturing/piston-seals/dk216/ https://abbeyseals.ie/seal-manufacturing/piston-seals/ 

Redirect 301 /seal-manufacturing/rod-seals/titel-185/ https://abbeyseals.ie/seal-manufacturing/rod-seals/ 

Redirect 301 /seal-manufacturing/rotary-seals/dr108/ https://abbeyseals.ie/seal-manufacturing/rotary-seals/ 

Redirect 301 /seal-manufacturing/o-rings-back-rings-gaskets/titel-212/ https://abbeyseals.ie/seal-manufacturing/o-rings-back-rings-gaskets/ 

Redirect 301 /seal-manufacturing/o-rings-back-rings-gaskets/titel-208/ https://abbeyseals.ie/seal-manufacturing/o-rings-back-rings-gaskets/ 

Redirect 301 /seal-manufacturing/rotary-seals/dr111/ https://abbeyseals.ie/seal-manufacturing/rotary-seals/ 
+0

但有没有跟踪这些302重定向,我会用.htaccess文件更新我的问题。 – Matteo

+0

您将不得不准备所有160个旧的和相应的新链接的列表。如果您有权访问Apache服务器配置文件,您可以使用'RewriteMap' – anubhava

+0

我有所有链接的列表,但我不希望将所有链接逐个移动。有没有一种巨大的方式来做到这一点? – Matteo

回答

2

插入此通用规则略高于# Start WPFC Exclude行:

RewriteRule ^/?(seal-manufacturing/[\w-]+/)(.+)$ /$1 [L,NE,R=301,NC] 
+1

太棒了!非常感谢! – Matteo