I am hoping that one of my fellow hubbers can help me with a coding problem. I would like to use htaccess mod_rewrite to change a large number of links (each with some variation) to a new external site. There are too many links to handcode and too many variables to do a search and replace.
Here is what I would like to do:
Current links examples:
Would now be rewritten:
The rewrite would be at the server level and the original html would remain.
So that all links, regardless of the original url all point to the same page on the new site. I know I need to use wildcard variables to allow for the fact that the url pointing to example.com has different html after the.com but I have not been able to get it to work and when I googled this subject I couldn't find a site that answered my question.
Thanks in advance for any help you can give me.
(ps. I am using an apache server)
A rule like this in the .htaccess on the example.com server will 301 redirect any URL on example.com to the same URL at newsite.com. For instance:
RewriteRule (.*) http://newsite.com/$1 [R=301,L]
http://example.com/foo.html -> http://newsite.com/foo.html
If you need to match certain urls and rewrite them to something else on the new server, just change the rules. For instance:
RewriteRule ^foo/(.*).html$ http://newsite.com/bar/$1.php [R=301,L]
http://example.com/foo/blah.html -> http://newsite.com/bar/blah.php
by Zoe 4 years ago
I wanted to add a contents to my hub with links to sections within the article. I managed to do this using the mod_##### number but then noticed that the links don't work when browsing with Safari on Iphone or Ipad, they just take you to the top of the page. They do work with Chrome for...
by Dorian Bodnariuc 4 years ago
I just checked a few of my former lenses, and it seems like 301 redirects from Squidoo don't work anymore.Does anyone know anything about this? I used to have some social media traffic, mostly from Pinterest and Google+. That traffic is lost now. Cheers,
by Silver Rose 7 years ago
Here's a post from googlewebmastercentral posted yesterday:http://googlewebmastercentral.blogspot. … ernal.htmlLook at the table where they show the differences. Previously scholar.google.com/ and sketchup.google.com/ were external links, now they are internal links.It's probably a response...
by Paul Edmondson 7 years ago
Today we are putting a few staff accounts on Subdomains. This is a pretty major change to the site that we've been working hard to get out as fast as possible. You can see an example at (In the next hour or two at) http://pauledmondson.hubpages.com Once we get data and work through bugs...
by Anthony Goodley 8 years ago
I have noticed that any link that you use a URL tracker code automatically redirects to the target page. I have started using trackers hoping to get a little from referrals. But I worry if they use a proper 301 redirect so Google Page Rank will flow through these trackers. If not most of my...
by Whitney 11 years ago
Ok, so I haven't gotten that aweful 999 error in MONTHS! and now, it seems there are so many perfect questions to post my links too, and I'm getting the 999 error! Anyone else having this problem? I was getting ok traffic from them, enough for my to be frustrated by this. Plus, like I said, today...
Copyright © 2019 HubPages Inc. and respective owners. Other product and company names shown may be trademarks of their respective owners. HubPages® is a registered Service Mark of HubPages, Inc. HubPages and Hubbers (authors) may earn revenue on this page based on affiliate relationships and advertisements with partners including Amazon, Google, and others.
|HubPages Device ID||This is used to identify particular browsers or devices when the access the service, and is used for security reasons.|
|Login||This is necessary to sign in to the HubPages Service.|
|HubPages Traffic Pixel||This is used to collect data on traffic to articles and other pages on our site. Unless you are signed in to a HubPages account, all personally identifiable information is anonymized.|
|Remarketing Pixels||We may use remarketing pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to advertise the HubPages Service to people that have visited our sites.|
|Conversion Tracking Pixels||We may use conversion tracking pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to identify when an advertisement has successfully resulted in the desired action, such as signing up for the HubPages Service or publishing an article on the HubPages Service.|