admin管理员组文章数量:1130349
I need some help with google indexing old PDF pages.
Here is the situation:
- I have a new URL of
new.example. - The website was rebuilt and the company name has changed.
- The URL used to be
old.example. - It has been about 7 months since the launch of the new website with the new URL.
- Google is still indexing PDF pages that show the old URL, and if a user clicks on this PDF/page they will also see the old company name and logo.
- I put a URL redirect on this PDF/page to go to the new URL, and the PDF will now show the user the new logo.
I have been able to redirect at a URL level and folder level in the past for various reasons.
Any suggestions how I can redirect ALL PDF pages at one time... if that makes sense? The problem is that they are not all in the same folder. Not sure if there is some sort of string/code I can add to the .htaccess file for this type of scenario?
I need some help with google indexing old PDF pages.
Here is the situation:
- I have a new URL of
new.example. - The website was rebuilt and the company name has changed.
- The URL used to be
old.example. - It has been about 7 months since the launch of the new website with the new URL.
- Google is still indexing PDF pages that show the old URL, and if a user clicks on this PDF/page they will also see the old company name and logo.
- I put a URL redirect on this PDF/page to go to the new URL, and the PDF will now show the user the new logo.
I have been able to redirect at a URL level and folder level in the past for various reasons.
Any suggestions how I can redirect ALL PDF pages at one time... if that makes sense? The problem is that they are not all in the same folder. Not sure if there is some sort of string/code I can add to the .htaccess file for this type of scenario?
- Do the old and new domains both point to the same hosting account? Are the URLs of the old and new PDF files the same and it's just the domain name that has changed? (In your question you appear to have also used the term "URL" to refer to the domain name.) – MrWhite Commented Oct 19, 2018 at 21:56
2 Answers
Reset to default 0If all of the .pdf pages need to redirect to the same page, and provided you don't have any .pdf pages that don't need redirecting, you might be able to use something like the following in your .htaccess file...
RewriteCond %{REQUEST_URI} .*\.(pdf)
RewriteRule ^(.*)/ https://new.example/new_page/ [R]
Assuming the old and new domains point to the same hosting account and that the filenames of the PDF files themselves have not changed and are located on the same URL-path at the new domain then you can redirect all .pdf files from the old domain to the new (regardless of where they are located), with the following at the top of your .htaccess file:
RewriteCond %{HTTP_HOST} =old.example
RewriteRule \.pdf$ https://new.example%{REQUEST_URI} [R=302,L]
If the old domain points to a different host then you can remove the condition that checks the requested hostname.
This is a 302 temporary redirect. Change it to a 301 (permanent) redirect only once you have confirmed it is working OK.
I need some help with google indexing old PDF pages.
Here is the situation:
- I have a new URL of
new.example. - The website was rebuilt and the company name has changed.
- The URL used to be
old.example. - It has been about 7 months since the launch of the new website with the new URL.
- Google is still indexing PDF pages that show the old URL, and if a user clicks on this PDF/page they will also see the old company name and logo.
- I put a URL redirect on this PDF/page to go to the new URL, and the PDF will now show the user the new logo.
I have been able to redirect at a URL level and folder level in the past for various reasons.
Any suggestions how I can redirect ALL PDF pages at one time... if that makes sense? The problem is that they are not all in the same folder. Not sure if there is some sort of string/code I can add to the .htaccess file for this type of scenario?
I need some help with google indexing old PDF pages.
Here is the situation:
- I have a new URL of
new.example. - The website was rebuilt and the company name has changed.
- The URL used to be
old.example. - It has been about 7 months since the launch of the new website with the new URL.
- Google is still indexing PDF pages that show the old URL, and if a user clicks on this PDF/page they will also see the old company name and logo.
- I put a URL redirect on this PDF/page to go to the new URL, and the PDF will now show the user the new logo.
I have been able to redirect at a URL level and folder level in the past for various reasons.
Any suggestions how I can redirect ALL PDF pages at one time... if that makes sense? The problem is that they are not all in the same folder. Not sure if there is some sort of string/code I can add to the .htaccess file for this type of scenario?
- Do the old and new domains both point to the same hosting account? Are the URLs of the old and new PDF files the same and it's just the domain name that has changed? (In your question you appear to have also used the term "URL" to refer to the domain name.) – MrWhite Commented Oct 19, 2018 at 21:56
2 Answers
Reset to default 0If all of the .pdf pages need to redirect to the same page, and provided you don't have any .pdf pages that don't need redirecting, you might be able to use something like the following in your .htaccess file...
RewriteCond %{REQUEST_URI} .*\.(pdf)
RewriteRule ^(.*)/ https://new.example/new_page/ [R]
Assuming the old and new domains point to the same hosting account and that the filenames of the PDF files themselves have not changed and are located on the same URL-path at the new domain then you can redirect all .pdf files from the old domain to the new (regardless of where they are located), with the following at the top of your .htaccess file:
RewriteCond %{HTTP_HOST} =old.example
RewriteRule \.pdf$ https://new.example%{REQUEST_URI} [R=302,L]
If the old domain points to a different host then you can remove the condition that checks the requested hostname.
This is a 302 temporary redirect. Change it to a 301 (permanent) redirect only once you have confirmed it is working OK.
本文标签: urlsRedirect only PDFs in different folders
版权声明:本文标题:urls - Redirect only PDFs in different folders? 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749244356a2338626.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论