Mobile app version of vmapp.org
Login or Join
Shanna517

: Redirecting some parts of a url ok let me try once again this link [www.mgdezigns.com/cards/festive_silver_purple_ornament_holiday_cards_postcard-239887577090743570.html] needs to be redirected to this[www.zazzle.com/festive_silver_purpl

@Shanna517

Posted in: #Htaccess #Redirects #UrlRewriting

ok let me try once again this link [www.mgdezigns.com/cards/festive_silver_purple_ornament_holiday_cards_postcard-239887577090743570.html]
needs to be redirected to this[www.zazzle.com/festive_silver_purple_ornament_holiday_cards_postcard-239887577090743570] OR [www.zazzle.com/239887577090743570] (both links are same and work, whichever is simpler to code)
because what I have pinned to pinterest is this
[www.mgdezigns.com/cards/festive_silver_purple_ornament_holiday_cards_postcard-239887577090743570.html]
and it shows empty page so what i want is that the people who click on this link [www.mgdezigns.com/cards/festive_silver_purple_ornament_holiday_cards_postcard-239887577090743570.html]
from pinned images at pinterest.com actually get redirected to [www.zazzle.com/festive_silver_purple_ornament_holiday_cards_postcard-239887577090743570 ] OR [www.zazzle.com/239887577090743570] (both links are same and work, whichever is simpler to code)
is something like this possible?
Thank You so much!
You will be a life saver!

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Shanna517

2 Comments

Sorted by latest first Latest Oldest Best

 

@Megan663

If you want to remove the .html on URLs that otherwise would end in a number, you could use this:

RedirectMatch permanent /(.*[0-9]).html$ /


Older versions of Apache (before 2.2.6) don't support relative URLs and you would have to use the full URL:

RedirectMatch permanent /(.*[0-9]).html$ www.zazzle.com/

10% popularity Vote Up Vote Down


 

@Alves908

You could do something like the following in .htaccess to match all the "cards", grabing just the number from the URL:

RewriteEngine On
RewriteRule ^cards/[a-z_]+-([d]{10,}).html$ www.zazzle.com/ [R=301,L]


To add more categories you could be explicit...

RewriteRule ^(?:cards|invitations|weddings)/[a-z_]+-([d]{10,}).html$ www.zazzle.com/ [R=301,L]


Or, be generic, to match anything in the first path segment:

RewriteRule ^[a-z]+/[a-z_]+-([d]{10,}).html$ www.zazzle.com/ [R=301,L]


In fact, you could just match any URL that ends in a hyphen followed by a long number...?

RewriteRule -([d]{10,}).html$ www.zazzle.com/ [R=301,L]

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme