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 Zoe2 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...
by Dorian Bodnariuc2 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...
by Paul Edmondson5 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...
by Silver Rose5 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...
by Christi Torgusson3 years ago
I go to view my hubpage but I get a "this user doesn't exist" error message. Can you please fix this? My username is torgusson, I have 4 articles that should be showing up, along with my profile, spotlights,...
by Robert P5 years ago
Hello Fellow Hubbers - A few weeks ago I posted a question to the forums asking whether any hubbers had used Reddit.com to create backlinks. Most people reported negative experiences, saying that the reddit community...
Copyright © 2017 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.