Problems in 301 redirections
-
Hi guys,
I just redirected the following URLs to one landing page (under a new domain):
Old URLs
http://www.olddomain.com/folder/page/1
http://www.olddomain.com/folder/page/2
http://www.olddomain.com/folder/page/3
http://www.olddomain.com/folder/page/4
http://www.olddomain.com/folder/page/5
http://www.olddomain.com/folder/page/6
New URL
http://www.newdomain.com/new-folder/new-page
Here's the code in .htaccess that I'm currently using:
RedirectMatch 301 /folder/page/(.*) http://www.newdomain.com/new-folder/new-page
The redirection rules are working well but the landing pages are showing special parameters like the following:
http://www.olddomain.com/folder/page/1 TO http://www.newdomain/new-folder/new-page?cmd=divisionsMain&group=2&country=1&category=1&page=1
http://www.olddomain.com/folder/page/2 TO http://www.newdomain/new-folder/new-page?cmd=divisionsMain&group=2&country=1&category=1&page=2
http://www.olddomain.com/folder/page/3 TO http://www.newdomain/new-folder/new-page?cmd=divisionsMain&group=2&country=1&category=1&page=3
http://www.olddomain.com/folder/page/4 TO http://www.newdomain/new-folder/new-page?cmd=divisionsMain&group=2&country=1&category=1&page=4
http://www.olddomain.com/folder/page/5 TO http://www.newdomain/new-folder/new-page?cmd=divisionsMain&group=2&country=1&category=1&page=5
http://www.olddomain.com/folder/page/6 TO http://www.newdomain/new-folder/new-page?cmd=divisionsMain&group=2&country=1&category=1&page=6
Here's what my .htaccess file look like:
Options +FollowSymLinks
RewriteEngine on#RewriteCond %{HTTP_HOST} ^beta|livescore.olddomain.com [NC]
#RewriteRule ^(.) - [L]
RewriteCond %{HTTP_HOST} !^www.olddomain.com [NC]
RewriteRule ^(.)$ http://www.%{HTTP_HOST}/$1 [R=301,L]#--Landing pages -start
RewriteRule ^apartment-for-rent-in-makati(/sort-([a-z0-9-]+))?((/)([0-9]+))?$ index.php?cmd=seoModule&sort=$2&page=$5 [L]
RewriteRule ^apartment-for-sale-in-makati(/sort-([a-z0-9-]+))?((/)([0-9]+))?$ index.php?cmd=seoModule&sort=$2&page=$5 [L]
RewriteRule ^for-rent-in-makati(/sort-([a-z0-9-]+))?((/)([0-9]+))?$ index.php?cmd=seoModule&sort=$2&page=$5 [L]
RewriteRule ^for-sale-in-makati(/sort-([a-z0-9-]+))?((/)([0-9]+))?$ index.php?cmd=seoModule&sort=$2&page=$5 [L]
RewriteRule ^apartment-for-rent-in-manila(/sort-([a-z0-9-]+))?((/)([0-9]+))?$ index.php?cmd=seoModule&sort=$2&page=$5 [L]
RewriteRule ^apartment-for-sale-in-manila(/sort-([a-z0-9-]+))?((/)([0-9]+))?$ index.php?cmd=seoModule&sort=$2&page=$5 [L]
RewriteRule ^serviced-apartments-ho-chi-minh-for-rent(/sort-([a-z0-9-]+))?((/)([0-9]+))?$ index.php?cmd=seoModule&sort=$2&page=$5 [L]
RewriteRule ^residential-housing-bangkok(/sort-([a-z0-9-]+))?((/)([0-9]+))?$ index.php?cmd=seoModule&sort=$2&page=$5 [L]
RewriteRule ^homes-for-sale(/sort-([a-z0-9-]+))?((/)([0-9]+))?$ index.php?cmd=seoModule&sort=$2&page=$5 [L]
RewriteRule ^houses-for-sale(/sort-([a-z0-9-]+))?((/)([0-9]+))?$ index.php?cmd=seoModule&sort=$2&page=$5 [L]
RewriteRule ^real-estate-listings(/sort-([a-z0-9-]+))?((/)([0-9]+))?$ index.php?cmd=seoModule&sort=$2&page=$5 [L]
RewriteRule ^house-listings(/sort-([a-z0-9-]+))?((/)([0-9]+))?$ index.php?cmd=seoModule&sort=$2&page=$5 [L]
RewriteRule ^rent-in-makati(/sort-([a-z0-9-]+))?((/)([0-9]+))?$ index.php?cmd=seoModule&sort=$2&page=$5 [L]
RewriteRule ^manila-apartments(/sort-([a-z0-9-]+))?((/)([0-9]+))?$ index.php?cmd=seoModule&sort=$2&page=$5 [L]
RewriteRule ^house-for-rent-manila(/sort-([a-z0-9-]+))?((/)([0-9]+))?$ index.php?cmd=seoModule&sort=$2&page=$5 [L]
RewriteRule ^apartment-for-rent-in-saigon(/sort-([a-z0-9-]+))?((/)([0-9]+))?$ index.php?cmd=seoModule&sort=$2&page=$5 [L]
RewriteRule ^apartment-for-rent-in-hcmc(/sort-([a-z0-9-]+))?((/)([0-9]+))?$ index.php?cmd=seoModule&sort=$2&page=$5 [L]
RewriteRule ^house-for-rent-vietnam(/sort-([a-z0-9-]+))?((/)([0-9]+))?$ index.php?cmd=seoModule&sort=$2&page=$5 [L]
RewriteRule ^house-for-rent-in-saigon(/sort-([a-z0-9-]+))?((/)([0-9]+))?$ index.php?cmd=seoModule&sort=$2&page=$5 [L]
RewriteRule ^philippine-real-estate-for-sale(/sort-([a-z0-9-]+))?((/)([0-9]+))?$ index.php?cmd=seoModule&sort=$2&page=$5 [L]
RewriteRule ^buy/houses/philippines/national-capital-region/makati/dasmarinas-village(/sort-([a-z0-9-]+))?((/)([0-9]+))?$ index.php?cmd=seoModule&sort=$2&page=$5 [L]
RewriteRule ^buy/apartments/philippines/national-capital-region/makati(/sort-([a-z0-9-]+))?((/)([0-9]+))?$ index.php?cmd=seoModule&sort=$2&page=$5 [L]
RewriteRule ^buy/apartments/philippines/national-capital-region/paranaque(/sort-([a-z0-9-]+))?((/)([0-9]+))?$ index.php?cmd=seoModule&sort=$2&page=$5 [L]
RewriteRule ^buy/apartments/philippines/national-capital-region/taguig/fort-bonifacio-global-city(/sort-([a-z0-9-]+))?((/)([0-9]+))?$ index.php?cmd=seoModule&sort=$2&page=$5 [L]
RewriteRule ^buy/condominiums/philippines/national-capital-region/makati(/sort-([a-z0-9-]+))?((/)([0-9]+))?$ index.php?cmd=seoModule&sort=$2&page=$5 [L]
RewriteRule ^buy/condominiums/philippines/national-capital-region/taguig/fort-bonifacio-global-city(/sort-([a-z0-9-]+))?((/)([0-9]+))?$ index.php?cmd=seoModule&sort=$2&page=$5 [L]
RewriteRule ^buy/houses/philippines/national-capital-region/makati(/sort-([a-z0-9-]+))?((/)([0-9]+))?$ index.php?cmd=seoModule&sort=$2&page=$5 [L]
RewriteRule ^buy/houses/philippines/national-capital-region/muntinlupa(/sort-([a-z0-9-]+))?((/)([0-9]+))?$ index.php?cmd=seoModule&sort=$2&page=$5 [L]
RewriteRule ^buy/houses/philippines/national-capital-region/pasig(/sort-([a-z0-9-]+))?((/)([0-9]+))?$ index.php?cmd=seoModule&sort=$2&page=$5 [L]
RewriteRule ^buy/houses/philippines/national-capital-region/quezon-city(/sort-([a-z0-9-]+))?((/)([0-9]+))?$ index.php?cmd=seoModule&sort=$2&page=$5 [L]
RewriteRule ^buy/office-spaces/philippines/national-capital-region/makati(/sort-([a-z0-9-]+))?((/)([0-9]+))?$ index.php?cmd=seoModule&sort=$2&page=$5 [L]
RewriteRule ^rent/apartments/philippines/national-capital-region/makati(/sort-([a-z0-9-]+))?((/)([0-9]+))?$ index.php?cmd=seoModule&sort=$2&page=$5 [L]
RewriteRule ^rent/commercial-spaces/philippines/national-capital-region/makati(/sort-([a-z0-9-]+))?((/)([0-9]+))?$ index.php?cmd=seoModule&sort=$2&page=$5 [L]
RewriteRule ^rent/office-spaces/philippines/national-capital-region/makati(/sort-([a-z0-9-]+))?((/)([0-9]+))?$ index.php?cmd=seoModule&sort=$2&page=$5 [L]
RewriteRule ^rent/condominiums/philippines/national-capital-region/makati(/sort-([a-z0-9-]+))?((/)([0-9]+))?$ index.php?cmd=seoModule&sort=$2&page=$5 [L]
RewriteRule ^rent/condominiums/philippines/national-capital-region/taguig/fort-bonifacio-global-city(/sort-([a-z0-9-]+))?((/)([0-9]+))?$ index.php?cmd=seoModule&sort=$2&page=$5 [L]
RewriteRule ^rent/houses/philippines/national-capital-region/muntinlupa(/sort-([a-z0-9-]+))?((/)([0-9]+))?$ index.php?cmd=seoModule&sort=$2&page=$5 [L]
RewriteRule ^rent/houses/philippines/national-capital-region/pasig(/sort-([a-z0-9-]+))?((/)([0-9]+))?$ index.php?cmd=seoModule&sort=$2&page=$5 [L]
RewriteRule ^rent/industrial_warehouses/philippines/national-capital-region/makati(/sort-([a-z0-9-]+))?((/)([0-9]+))?$ index.php?cmd=seoModule&sort=$2&page=$5 [L]
RewriteRule ^rent/industrial_warehouses/philippines/national-capital-region/mandaluyong(/sort-([a-z0-9-]+))?((/)([0-9]+))?$ index.php?cmd=seoModule&sort=$2&page=$5 [L]
RewriteRule ^rent/land_developments/philippines/national-capital-region/taguig/fort-bonifacio-global-city(/sort-([a-z0-9-]+))?((/)([0-9]+))?$ index.php?cmd=seoModule&sort=$2&page=$5 [L]
RewriteRule ^buy/pre-selling_project-sales/philippines/national-capital-region/makati(/sort-([a-z0-9-]+))?((/)([0-9]+))?$ index.php?cmd=seoModule&sort=$2&page=$5 [L]
RewriteRule ^rent/office-spaces/philippines/national-capital-region/pasig/ortigas(/sort-([a-z0-9-]+))?((/)([0-9]+))?$ index.php?cmd=seoModule&sort=$2&page=$5 [L]
RewriteRule ^rent/office-spaces/philippines/national-capital-region/taguig/fort-bonifacio-global-city(/sort-([a-z0-9-]+))?((/)([0-9]+))?$ index.php?cmd=seoModule&sort=$2&page=$5 [L]
RewriteRule ^buy/pre-selling_project-sales/philippines/national-capital-region/taguig/fort-bonifacio-global-city(/sort-([a-z0-9-]+))?((/)([0-9]+))?$ index.php?cmd=seoModule&sort=$2&page=$5 [L]
#--Landing pages -end#--Redirect pages -start
RewriteRule ^apartment-for-rent-philippines$ /rent/apartments/philippines [R=301,L]
RewriteRule ^serviced-apartments-ho-chi-minh-for-rent$ /rent/serviced-apartments/vietnam/south/ho-chi-minh-city [R=301,L]
RewriteRule ^rent/apartments/vietnam/ho-chi-minh-city/serviced-apartment-for-rent-in-Ho-Chi-Minh-City$ /rent/serviced-apartments/vietnam/south/ho-chi-minh-city [R=301,L]
RewriteRule ^apartment-for-rent-in-saigon$ /rent/apartments/vietnam/south/ho-chi-minh-city [R=301,L]
RewriteRule ^rent/apartments/vietnam/ho-chi-minh-city/apartment-for-rent-in-Saigon$ /rent/apartments/vietnam/south/ho-chi-minh-city [R=301,L]
RewriteRule ^philippine-real-estate-for-sale$ /residential-properties [R=301,L]
RewriteRule ^house-for-rent-in-saigon$ /rent/houses/vietnam/south/ho-chi-minh-city [R=301,L]
RewriteRule ^house-for-rent-vietnam$ /rent/villas/vietnam [R=301,L]
RewriteRule ^condo-for-rent-philippines$ /rent/condominiums/philippines [R=301,L]
RewriteRule ^makati-condominiums$ /buy/condominiums/philippines/national-capital-region/makati [R=301,L]
RewriteRule ^apartment-for-rent-in-hcmc$ /rent/apartments/vietnam/south/ho-chi-minh-city [R=301,L]
RewriteRule ^apartment-for-rent-in-saigon$ /rent/apartments/vietnam/south/ho-chi-minh-city [R=301,L]
RewriteRule ^house-for-rent-manila$ /rent/houses/philippines/national-capital-region/manila [R=301,L]
RewriteRule ^manila-apartments$ /rent/apartments/philippines/national-capital-region/manila [R=301,L]
RewriteRule ^rent-in-makati$ /rent/apartments/philippines/national-capital-region/makati [R=301,L]
RewriteRule ^house-listings$ /residential-properties [R=301,L]
RewriteRule ^real-estate-listings$ /residential-properties [R=301,L]
RewriteRule ^houses-for-sale$ /residential-properties [R=301,L]
RewriteRule ^homes-for-sale$ /residential-properties [R=301,L]
RewriteRule ^residential-housing-bangkok$ /buy/houses/thailand/central/bangkok [R=301,L]
RewriteRule ^hcmc-apartment-rent$ /rent/apartments/vietnam/south/ho-chi-minh-city [R=301,L]
RewriteRule ^serviced-apartments-ho-chi-minh-for-rent$ /rent/serviced-apartments/vietnam/south/ho-chi-minh-city [R=301,L]
RewriteRule ^saigon-apartment-rent$ /rent/apartments/vietnam/south/ho-chi-minh-city [R=301,L]
RewriteRule ^apartment-for-sale-in-manila$ /buy/apartments/philippines/national-capital-region/manila [R=301,L]
RewriteRule ^apartment-for-rent-in-manila$ /rent/apartments/philippines/national-capital-region/manila [R=301,L]
RewriteRule ^for-sale-in-makati$ /buy/houses/philippines/national-capital-region/makati [R=301,L]
RewriteRule ^for-rent-in-makati$ /rent/houses/philippines/national-capital-region/makati [R=301,L]
RewriteRule ^apartment-for-sale-in-makati$ /buy/apartments/philippines/national-capital-region/makati [R=301,L]
RewriteRule ^apartment-for-rent-in-makati$ /rent/apartments/philippines/national-capital-region/makati [R=301,L]
RewriteRule ^rent/villas/vietnam/ho-chi-minh-city/house-for-rent-in-saigon$ /rent/houses/vietnam/south/ho-chi-minh-city [R=301,L]
#--Redirect pages -end#--custom landing pages from Ramon -start | Rnel
#--13-Mar-2012
RewriteRule ^rent/(apartments|villas)/vietnam/ho-chi-minh-city/([a-zA-Z-]+)-for-rent-in-([a-zA-Z-]+)((/)([0-9]+))?$ index.php?cmd=divisionsMain&mainDivision=1&country=vietnam&group=1&custom_category=$2&custom_area=$3&custom_city=25443&custom=1&page=$6 [L]
RewriteRule ^rent/vietnam/ho-chi-minh-city/district-1/ho-chi-minh-city-(district-1|real-estate)((/)([0-9]+))?$ index.php?cmd=divisionsMain&mainDivision=1&country=vietnam&group=1&custom_target=$1&custom_city=25443&custom=2&page=$4 [L]
RewriteRule ^rent/apartments/vietnam/ho-chi-minh-city/saigon-pearl-(apartment-for-rent|for-rent)((/)([0-9]+))?$ index.php?cmd=divisionsMain&mainDivision=1&country=vietnam&group=1&custom_target=$1&custom_city=25443&custom=3&page=$6 [L]#-24-April-2012 | Apartment for rent in makati | 08-May-2012 changed to apartment-for-rent-in-makati
#RewriteRule ^rent/apartments/philippines/national-capital-region/makati((/)([0-9]+))?$ /rent/apartments/philippines/national-capital-region/apartment-for-rent-in-makati$1 [R=301]
#RewriteRule ^rent/apartments/philippines/national-capital-region/apartment-for-rent-in-makati((/)([0-9]+))?$ index.php?cmd=divisionsMain&group=1&country=philippinesion=national-capital-region&city=makati&category=apartments&page=$3 [L]
#RewriteRule ^rent/apartments/philippines/national-capital-region/makati((/)([0-9]+))?$ /apartment-for-rent-in-makati$1 [R=301]
#RewriteRule ^buy/apartments/philippines/national-capital-region/makati((/)([0-9]+))?$ /apartment-for-sale-in-makati$1 [R=301]
#RewriteRule ^rent/apartments/philippines/national-capital-region/apartment-for-rent-in-makati((/)([0-9]+))?$ /apartment-for-rent-in-makati$1 [R=301]
#RewriteRule ^apartment-for-rent-in-makati(/sort-([a-z0-9-]+))?((/)([0-9]+))?$ index.php?cmd=divisionsMain&group=1&country=philippinesion=national-capital-region&city=makati&category=apartments&page=$5&sort=$2 [L]
#RewriteRule ^apartment-for-sale-in-makati(/sort-([a-z0-9-]+))?((/)([0-9]+))?$ index.php?cmd=divisionsMain&group=2&country=philippinesion=national-capital-region&city=makati&category=apartments&page=$5&sort=$2 [L]#--03-May-2012 - Manila | 07-May-2012 - Makati | (rent|buy)/
#RewriteRule ^rent/apartment-for-rent-in-manila$ /apartment-for-rent-in-manila [R=301]
#RewriteRule ^(apartment-)?for-(rent|sale)-in-(manila|makati)(/sort-([a-z0-9-]+))?((/)([0-9]+))?$ index.php?cmd=divisionsMain&mainDivision=1&country=philippines&group_name=$2&custom_target=&custom_region=1&custom_city=$3&custom=4&page=$8&sort=$5 [L]
#--custom landing pages from Ramon|Claudio -endNovember 26 2013 - migration testing from olddomain to newdomain
RedirectMatch 301 /folder/page/(.*) http://www.newdomain.com/new-folder/new-page
End
<files 403.shtml="">order allow,deny
allow from all</files>deny from 173.245.84.49
deny from 92.40.44.99
deny from 92.41.197.133
deny from 41.58.53.131
deny from 41.184.129.141
deny from 112.135.153.58
deny from 41.138.169.191
deny from 41.58.19.87
deny from 199.58.164.113
deny from 41.71.158.188
deny from 81.149.227.17
deny from 95.211.231.222
deny from 41.58.196.39Do you guys know why the landing pages are showing special parameters though I didn't add anything in the 301 redirection rules?
-
Thanks for sharing the links Thomas! I'll check these tools right away.
-
Use one the the two tools
http://seo-website-designer.com/HtAccess-301-Redirect-Generator
Underneath the generated code box you will see a line that says
"Here's an overview on what it does"
this will explain to you how to simply and move the ? strange parameter issue.
or
You may also want to make some redirects with this tool.
http://www.htaccessredirect.net/
All the best,
Thomas
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
Redirecting from https to http - will pass whole link juice to new http website pages?
Hi making permanent 301 redirection from https to http - will pass whole link juice to new http website pages?
White Hat / Black Hat SEO | | Aman_1230 -
Removing/ Redirecting bad URL's from main domain
Our users create content for which we host on a seperate URL for a web version. Originally this was hosted on our main domain. This was causing problems because Google was seeing all these different types of content on our main domain. The page content was all over the place and (we think) may have harmed our main domain reputation. About a month ago, we added a robots.txt to block those URL's in that particular folder, so that Google doesn't crawl those pages and ignores it in the SERP. We now went a step further and are now redirecting (301 redirect) all those user created URL's to a totally brand new domain (not affiliated with our brand or main domain). This should have been done from the beginning, but it wasn't. Any suggestions on how can we remove all those original URL's and make Google see them as not affiliated with main domain?? or should we just give it the good ol' time recipe for it to fix itself??
White Hat / Black Hat SEO | | redcappi0 -
All pages going through 302 redirect - bad?
So, our web development company did something I don't agree with and I need a second opinion. Most of our pages are statically cached (the CMS creates .html files), which is required because of our traffic volume. To get geotargeting to work, they've set up every page to 302 redirect to a geodetection script, and back to the geotargeted version of the page. Eg: www.example.com/category 302 redirects to www.example.com/geodetect.hp?ip=ip_address. Then that page 302 redirects back to either www.example.com/category, or www.example.com/geo/category for the geo-targeted version. **So all of our pages - thousands - go through a double 302 redirect. It's fairly invisible to the user, and 302 is more appropriate than 301 in this case, but it really worries me. I've done lots of research and can't find anything specifically saying this is bad, but I can't imagine Google being happy with this. ** Thoughts? Is this bad for SEO? Is there a better way (keeping in mind all of our files are statically generated)? Is this perfectly fine?
White Hat / Black Hat SEO | | dholowiski0 -
Google Reconsideration Requests no problem... So what do I do next?
Hi all, So I recently filed a Google reconsideration request - but it came back saying "No manual spam actions found" - ok, so that's that. But from what I've read, if we have been hit by Panda for duplicate or thin content, we wouldn't know - in other words, Google does not report it as it is an algorhythm penalty as opposed to a manual one. So what are my options - do I wait until the next Panda update? when can that be? Or do I start over on a fresh domain? Input and views appreciated. thanks,
White Hat / Black Hat SEO | | bjs20100 -
Homepage redirect
I'd like to get some thoughts about redirecting your homepage URL (www.site.com) to a keyword rich URL (www.site.com/super-awesome-best-thing-ever). Thank you, in advance.
White Hat / Black Hat SEO | | FrankSweeney0 -
Penalised by Google - Should I Redirect to a new domain?
Last month my rankings dropped a couple of pages on Google and am no longer receiving as many visits from Google as I used to. It's coming up to summer which is the time my business naturally picks up yet I can't fix this problem. I have a crazy idea of redirecting my established site onto a new domain in hopes that the penalty would be removed. I have tried removing any manipulative links yet my ranking are not coming back. Anyone had success in redirecting to a new domain?
White Hat / Black Hat SEO | | penn730 -
Problems with link spam from spam blogs to competitor sites
A competitor of ours is having a great deal of success with links from spam blogs (such as: publicexperience.com or sexylizard.org) it is proving to be a nightmare. Google does not detect these (the competitor has been doing well now for over a year) and my boss is starting to think if you can’t beat them, join them. Frankly, he is right – we have built some great links but it is nigh on impossible to beat 400+ highly targeted spam links in a niche market. My question is, has anyone had success in getting this sort of stuff brought to the attention of Google and banned (I actually listed them all in a message in webmaster tools and sent them over to Google over a year ago!). This is frustrating, I do not want to join in this kind of rubbish but it is hard to put a convincing argument against it when our competitor has used the technique successfully for over a year without any penalty. Ideas? Thoughts? All help appreciated
White Hat / Black Hat SEO | | RodneyRiley0