Domanda

I have following type of url that has been reported by Google as 401

http://example.com/products/name/product-name/support@email.com
http://example.com/product-name.php%5C%22
http://example.com/career/%7Bjoblink%7D

how do I 301 these urls using htaccess? What I tried is as follow but didnt worked:

RewriteCond %{HTTP_HOST} ^example.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.example.com$
RewriteRule ^products\/name\/product\-name\/support\@email\.com$ "http\:\/\/www\.exmaple\.com\/products\.php" [R=301,L]

does those special characters such as @ requires different approach?

Thanks!

È stato utile?

Soluzione

You can use this rule with B flag in your /blog/.htaccess file:

RewriteEngine On
RewriteBase /blog/

RewriteCond %{HTTP_HOST} ^(www\.)?example\.com$
RewriteRule ^2010/01/drying-glass-washing/doug@ 2010/01/drying-glass-washing/ [R=301,L,B,NC]

For rest of 2 URLs have these 2 rules in root .htaccess:

RewriteRule ^(product-name.php).+ /$1 [R=301,L,NC]

RewriteRule ^(career/)[^\w-] /$1 [R=301,L,NC]
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top