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!
You can use the following rule
RewriteEngine on
RewriteCond %{THE_REQUEST} /%22tel [NC]
RewriteRule ^ /page-1.html [L,R]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.