1

I have some issues with Google indexing certain unwanted URLs on my site such as http://www.example.com/%22tel:333-444-1234, where the number part is dynamic. These pages do not exist, and I am hoping to remove these links from Google's index by using the rel="nofollow" tag. But meanwhile I would like to redirect all URLs containing the string "%22tel:" to a page on my site such as http://www.example.com/page1.html.

I am using Apache. How do I do this?

I tried these codes, it doesn't seem to work.

RewriteEngine on
RewriteCond %{REQUEST_URI} ^\%22tel:
RewriteRule ^(.*)$ http://www.example.com/page1.html/

RewriteRule ^(.*)\%22tel:(.*)$ http://www.example.com/page1.html [L,R=301]

Thanks!

4
  • How do these URLs come about in the first place, are you generating them? Would returning a 404 not be the more suitable way to remove the URLs from the search index? Commented Jan 31, 2017 at 8:31
  • @Pekka웃 Yes, I generate the URLs. But the idea was to allow phone users to dial the number by clicking on the link. I am actually trying to remove them from the Google Search Console error list where I need to 'Fix' them. Commented Jan 31, 2017 at 8:35
  • Just sending a 404 would fix the problem relatively quickly... or having them in a subdirectory: /tel/.... and excluding it from search engines in the robots.txt. Commented Jan 31, 2017 at 9:00
  • @Pekka웃 thanks! starkeen's answer solved the redirect issue Commented Jan 31, 2017 at 10:10

1 Answer 1

2

You can use the following rule

RewriteEngine on
RewriteCond %{THE_REQUEST} /%22tel [NC]
RewriteRule ^ /page-1.html [L,R]
Sign up to request clarification or add additional context in comments.

1 Comment

That's great! Thank you :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.