我们最近将网站迁移到了WordPress。为了实现良好的迁移,我们希望te 301将所有旧URL重定向到新URL。
旧网址如下所示:
www.website.nl/site/producten.html?offset=256&pg=20070124
我尝试了所有内容来重定向这些页面,但没有任何效果。即使重定向到主页也无法正常工作。
我试过这样的事情:
RewriteCond %{QUERY_STRING} pg=20070124
RewriteRule ^producten.html(.*) /producten/? [R=301,L]
但没有运气。如何以正确的方式重定向这些URL?
我很幸运,但我仍然在我的网址后得到了?offset = 256& pg = 20070124。
有没有一种方法可以301重定向这些URL?
这是我目前的HTACCESS
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php
RewriteCond %{HTTP_HOST} ^www\.(.+)$
RewriteRule ^ https://%1%{REQUEST_URI} [L,R=301]
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
Redirect 301 /site/producten.html https://website.nl/
Redirect 301 /site/productenindex.html https://website.nl/
Redirect 301 /site/algemene_voorwaarden.html https://website.nl/privacy/
Redirect 301 /site/besparen.html https://website.nl/
Redirect 301 /site/douche.html https://website.nl/badkamer/
Redirect 301 /site/dakgoot.html https://website.nl/dakgoten/
Redirect 301 /site/contact.html https://website.nl/contact/
Redirect 301 /site/elektra.html https://website.nl/diensten/installatiebedrijf-den-bosch/
Redirect 301 /site/radiator.html https://website.nl/cv-ketels/
Redirect 301 /site/sanitair.html https://website.nl/badkamer/
Redirect 301 /site/schakelmateriaal.html https://website.nl/diensten/installateur-den-bosch/
Redirect 301 /site/duurzaam.html https://website.nl/
Redirect 301 /site/bad.html https://website.nl/badkamer/
Redirect 301 /site/meubelen.html https://website.nl/
Redirect 301 /site/boiler.html https://website.nl/cv-ketels/
Redirect 301 /site/verlichting.html https://website.nl/
Redirect 301 /site/ketel.html https://website.nl/cv-ketels/
Redirect 301 /site/leidingen.html https://website.nl/loodgieter/
Redirect 301 /site/dakbedekking.html https://website.nl/
Redirect 301 /site/afvoer.html https://website.nl/verstoppingen/
Redirect 301 /site/toilet.html https://website.nl/loodgieter/
Redirect 301 /site/warmteterug.html https://website.nl/cv-ketels/
Redirect 301 /site/geiser.html https://website.nl/cv-ketels/
Redirect 301 /site/vloer.html https://website.nl/
Redirect 301 /site/kranen.html https://website.nl/badkamer/
Redirect 301 /site/wastafels.html https://website.nl/badkamer/
Redirect 301 /site/zonneenergie.html https://website.nl/
Redirect 301 /site/loodgietwerk.html https://website.nl/loodgieter/
Redirect 301 /site/verwarming.html https://website.nl/cv-ketels/
Redirect 301 /site/convector.html https://website.nl/cv-ketels/
Redirect 301 /site/algemeen4.html https://website.nl/
Redirect 301 /site/producten/hommage-wastafelonderkast-69x.20412735.html https://website.nl/
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\ /site/producten\.html\?offset=(.+)&pg=([^&\s]+)
RewriteRule ^ /producten/? [R=301,L]
</IfModule>
答案 0 :(得分:1)
如果请求无效,请尝试使用该请求。
RewriteEngine on
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\ /site/producten\.html\?offset=(.+)&pg=([^&\s]+)
RewriteRule ^ /producten/? [R=301,L]