#1  
09-13-2016, 09:07 PM
karikuy karikuy is offline
Free Member
 
Join Date: Sep 2016
Posts: 6
Thanked 0 Times in 0 Posts
Hello,

This is my first post and I just want to say thank you in advance and appreciate the help.

I recently change domains for my website at www.karikuy.org to www.karikuy.com.

However now when i type Karikuy in my web browser (chrome) i get redirected to a 404 error, the address reads www.karikuy.org, I notices on exterior links such as blogs that link back to our website they have the address as www.karikuy.org but when clicked the 404 error comes up as well when it should be redirected. I have included the .htaccess code below. Note that I only want some pages to be redirected at the moment and not the whole site as our popular blog is staying put at www.karikuy.org/blog.

I am wondering if I am missing anything in the code, I also noticed that on itinerary pages we send out to customers we have a link to our index page at the old domain http://www.karikuy.org/index however this link sends back a site can't be reached page and the domain shows as http://www.karikuy.comindex/

Please let me know how to fix this error if possible, thanks again

Code:
RewriteEngine On
Options +FollowSymLinks

RewriteCond %{HTTP_HOST} ^karikuy.org
RewriteRule (.*) http://www.karikuy.com/$1 [R=301,L]

RewriteCond %{THE_REQUEST} ^.*/index
RewriteRule ^(.*)index.html$ http://www.karikuy.com/$1 [R=301,L]

RedirectPermanent /about http://www.karikuy.com/about.html
RedirectPermanent /tours http://www.karikuy.com/
RedirectPermanent /machu-picchu-tour http://www.karikuy.com/machu-picchu-tour.html
RedirectPermanent /machu-picchu-sunrise-tour http://www.karikuy.com/machu-picchu-sunrise-tour.html
RedirectPermanent /machu-picchu-by-car http://www.karikuy.com/machu-picchu-by-car.html
RedirectPermanent /inca-trail http://www.karikuy.com/inca-trail.html
RedirectPermanent /short-inca-trail http://www.karikuy.com/short-inca-trail.html
RedirectPermanent /jungle-inca-trail http://www.karikuy.com/jungle-inca-trail.html
RedirectPermanent /salkantay-trek http://www.karikuy.com/salkantay-trek.html
RedirectPermanent /jungle-inca-trail http://www.karikuy.com/jungle-inca-trail.html
RedirectPermanent /lares-trek http://www.karikuy.com/lares-trek.html
RedirectPermanent /huchuy-qosqo http://www.karikuy.com/huchuy-qosqo.html
RedirectPermanent /corto-maltes-amazonia http://www.karikuy.com/corto-maltes.html
RedirectPermanent /ecoamazonia http://www.karikuy.com/eco-amazonia.html
RedirectPermanent /inkaterra-hacienda-concepcion http://www.karikuy.com/hacienda-concepcion.html
RedirectPermanent /rainforest-expeditions http://www.karikuy.com/rainforest-expeditions.html
RedirectPermanent /inkaterra-reserva-amazonica http://www.karikuy.com/reserva-amazonica.html
RedirectPermanent /wasai http://www.karikuy.com/wasai.html
RedirectPermanent /testimonials http://www.karikuy.com/testimonials.html
RedirectPermanent /faq http://www.karikuy.com/frequently-asked-questions.html
RedirectPermanent /contact http://www.karikuy.com/contact.html
RedirectPermanent /terms http://www.karikuy.com/terms.html
RedirectPermanent /volunteer http://www.karikuy.com/volunteer.html
RedirectPermanent /kawsay http://www.karikuy.com/kawsay.html
Reply With Quote
Someday, 12:01 PM
admin's Avatar
Ads / Sponsors
 
Join Date: ∞
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts
  #2  
09-13-2016, 10:01 PM
kpmedia's Avatar
kpmedia kpmedia is offline
Site Staff | Web Hosting, Photo
 
Join Date: Feb 2004
Posts: 4,311
Thanked 374 Times in 341 Posts
The non-www "karikuy.org" is actually redirecting without an issue. Did you see that?

All we need to do is tweak or add to the htaccess to also capture www.

One smart idea is to force-redirect all to "www" first:
Code:
RewriteCond %{HTTP_HOST} !^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
Or longer, specifying domains:
Code:
RewriteCond %{HTTP_HOST} !^www\.karikuy\.org [NC]
RewriteRule (.*) http://www.karikuy.org/$1 [L,R=301] 
RewriteCond %{HTTP_HOST} !^www\.karikuy\.com [NC]
RewriteRule (.*) http://www.karikuy.com/$1 [L,R=301]
Then redirect the domains after that.

Or, maybe, this will do both redirect + www enforcing (htaccess can be tricky, would have to test it):
Code:
RewriteCond %{HTTP_HOST} !^www\.karikuy\.(com|org) [NC]
RewriteRule (.*) http://www.karikuy.com/$1 [L,R=301]
Granted you're already using WordPress, which internally rewrites non-www to www, but you may (someday) want non-WP content on that domain. So may as well solve it now.

- Did my advice help you? Then become a Premium Member and support this site.
- Please Like Us on Facebook | Follow Us on Twitter

- Need a good web host? Ask me for help! Get the shared, VPS, semi-dedicated, cloud, or reseller you need.
Reply With Quote
  #3  
09-14-2016, 01:19 AM
karikuy karikuy is offline
Free Member
 
Join Date: Sep 2016
Posts: 6
Thanked 0 Times in 0 Posts
Is there anyway to test this in realtime, I am testing on two different browsers, chrome and edge and they are both loading different results and confusing me. It seems that at first your fixes worked but then i was not able to get into www.karikuy.org/itin/yull which are customer itinerary folders we use. And there is still no way to get http://www.karikuy.org/index to redirect it always sends to http://www.karikuy.comindex/ in chrome and in edge there is a 404 page not found. I tried all three fixes and they all seemed to fix the www.karikuy.org to redirect to .com but in the process broke the ability to get to the itinerary files. Any help is much appreciated.
Reply With Quote
  #4  
09-14-2016, 01:31 AM
kpmedia's Avatar
kpmedia kpmedia is offline
Site Staff | Web Hosting, Photo
 
Join Date: Feb 2004
Posts: 4,311
Thanked 374 Times in 341 Posts
Right now, the .org are all giving 500 errors.

Browsers like to cache too much. And when you see one browser giving a different result than another, browser cache is at fault. So you'll need to flush the browser cache often, when testing redirects.

You won't be able to (easily, at least) have content on both the .com and .org, if that's what you're trying.

'/index' is a terrible folder name, and browsers sometimes insist on making it 'index.html'. That's what happens when you try to add a /index to the .com name, and it redirects to the root index of the site.

- Did my advice help you? Then become a Premium Member and support this site.
- Please Like Us on Facebook | Follow Us on Twitter

- Need a good web host? Ask me for help! Get the shared, VPS, semi-dedicated, cloud, or reseller you need.
Reply With Quote
  #5  
09-14-2016, 01:54 AM
karikuy karikuy is offline
Free Member
 
Join Date: Sep 2016
Posts: 6
Thanked 0 Times in 0 Posts
ok http://www.karikuy.org/index aside, what do i need to do to have the www.karikuy.org redirect to .com and still be able to access http://www.karikuy.org/itin/yull

When i use your code it fixes the redirection, the blog works but I have no access to the itinerary pages, this is the code being used right now

Code:
RewriteCond %{HTTP_HOST} !^www\.karikuy\.org [NC]
RewriteRule (.*) http://www.karikuy.org/$1 [L,R=301]
RewriteCond %{HTTP_HOST} !^www\.karikuy\.com [NC]
RewriteRule (.*) http://www.karikuy.com/$1 [L,R=301]
RedirectPermanent /about http://www.karikuy.com/about.html
RedirectPermanent /tours http://www.karikuy.com/
RedirectPermanent /machu-picchu-tour http://www.karikuy.com/machu-picchu-tour.html
RedirectPermanent /machu-picchu-sunrise-tour http://www.karikuy.com/machu-picchu-sunrise-tour.html
RedirectPermanent /machu-picchu-by-car http://www.karikuy.com/machu-picchu-by-car.html
RedirectPermanent /inca-trail http://www.karikuy.com/inca-trail.html
RedirectPermanent /short-inca-trail http://www.karikuy.com/short-inca-trail.html
RedirectPermanent /jungle-inca-trail http://www.karikuy.com/jungle-inca-trail.html
RedirectPermanent /salkantay-trek http://www.karikuy.com/salkantay-trek.html
RedirectPermanent /jungle-inca-trail http://www.karikuy.com/jungle-inca-trail.html
RedirectPermanent /lares-trek http://www.karikuy.com/lares-trek.html
RedirectPermanent /huchuy-qosqo http://www.karikuy.com/huchuy-qosqo.html
RedirectPermanent /corto-maltes-amazonia http://www.karikuy.com/corto-maltes.html
RedirectPermanent /ecoamazonia http://www.karikuy.com/eco-amazonia.html
RedirectPermanent /inkaterra-hacienda-concepcion http://www.karikuy.com/hacienda-concepcion.html
RedirectPermanent /rainforest-expeditions http://www.karikuy.com/rainforest-expeditions.html
RedirectPermanent /inkaterra-reserva-amazonica http://www.karikuy.com/reserva-amazonica.html
RedirectPermanent /wasai http://www.karikuy.com/wasai.html
RedirectPermanent /testimonials http://www.karikuy.com/testimonials.html
RedirectPermanent /faq http://www.karikuy.com/frequently-asked-questions.html
RedirectPermanent /contact http://www.karikuy.com/contact.html
RedirectPermanent /terms http://www.karikuy.com/terms.html
RedirectPermanent /volunteer http://www.karikuy.com/volunteer.html
RedirectPermanent /kawsay http://www.karikuy.com/kawsay.html
Reply With Quote
  #6  
09-14-2016, 02:03 AM
kpmedia's Avatar
kpmedia kpmedia is offline
Site Staff | Web Hosting, Photo
 
Join Date: Feb 2004
Posts: 4,311
Thanked 374 Times in 341 Posts
Code:
RewriteCond %{HTTP_HOST} !^www\.karikuy\.org [NC]
RewriteCond %{REQUEST_URI} !/itin/ [NC]
RewriteRule (.*) http://www.karikuy.org/$1 [L,R=301]
RewriteCond %{HTTP_HOST} !^www\.karikuy\.com [NC]
RewriteRule (.*) http://www.karikuy.com/$1 [L,R=301]
What that means:
- take not-www.org
- except /itin/*
- make www.org
- take not-www.com
- make www.com

It's easy to screw up htaccess, and it can be fiddly between Windows conversions (my reason for knowing it) and Linux. So I'm not 100% sure this will work, but it should. Syntax can be tricky when lots of punctuation is involved!

- Did my advice help you? Then become a Premium Member and support this site.
- Please Like Us on Facebook | Follow Us on Twitter

- Need a good web host? Ask me for help! Get the shared, VPS, semi-dedicated, cloud, or reseller you need.
Reply With Quote
  #7  
09-14-2016, 02:11 AM
karikuy karikuy is offline
Free Member
 
Join Date: Sep 2016
Posts: 6
Thanked 0 Times in 0 Posts
Thanks again for the help but it did not work, it changes the address to https://www.karikuy.com/itin/yull.html where I get a 404

Why is it that this code fixes the itin sub directory but doesn't redirect the domain?

Code:
RewriteEngine On
Options +FollowSymLinks

RewriteCond %{HTTP_HOST} ^karikuy.org
RewriteRule (.*) http://www.karikuy.com/$1 [R=301,L]
RewriteCond %{THE_REQUEST} ^.*/index
RewriteRule ^(.*)index.html$ http://www.karikuy.com/$1 [R=301,L]
Reply With Quote
  #8  
09-14-2016, 02:19 AM
kpmedia's Avatar
kpmedia kpmedia is offline
Site Staff | Web Hosting, Photo
 
Join Date: Feb 2004
Posts: 4,311
Thanked 374 Times in 341 Posts
Just FYI, on most Linux servers, this does nothing but waste space:
Code:
RewriteEngine On
Options +FollowSymLinks
Code:
RewriteCond %{HTTP_HOST} ^karikuy.org
RewriteRule (.*) http://www.karikuy.com/$1 [R=301,L]
RewriteCond %{THE_REQUEST} ^.*/index
RewriteRule ^(.*)index.html$ http://www.karikuy.com/$1 [R=301,L]
^ This says:

- if .org --- note the difference, mine shows the ! negative of "if not www"
- then redirect to www --- and this doesn't always work, hence the ! negative version
- take anything /index (including "index.html" or "index.qwerty", etc)
- redirect index.html to root (ie, remove index.html)

It "works" because the intended function isn't working.

It also explains why the /index folder is going to index.html. It's not a browser this time, but your own htaccess causing that.

You have to write syntax that fully redirect .org to .com, but excludes that one folder.

Why not just move the "itin" to the .com?

- Did my advice help you? Then become a Premium Member and support this site.
- Please Like Us on Facebook | Follow Us on Twitter

- Need a good web host? Ask me for help! Get the shared, VPS, semi-dedicated, cloud, or reseller you need.
Reply With Quote
  #9  
09-14-2016, 02:28 AM
karikuy karikuy is offline
Free Member
 
Join Date: Sep 2016
Posts: 6
Thanked 0 Times in 0 Posts
We have customers that have itineraries on the .org, a lot of itineraries, while at the dot com that site is hosted by weebly and they do not allow ftp so no way of transferring those over. I would have thought there was an easier way by just changing the .htaccess

Why is the /blog directory unaffected? that is not redirected.

Can you check my site, looks like i fixed it, you had the same line of code twice, I think that is why it was not working.
Reply With Quote
  #10  
09-14-2016, 02:59 AM
kpmedia's Avatar
kpmedia kpmedia is offline
Site Staff | Web Hosting, Photo
 
Join Date: Feb 2004
Posts: 4,311
Thanked 374 Times in 341 Posts
I still see errors in the redirects.

What did I have twice?

Good luck with Weebly. You do realize that you're locked into a proprietary mess now, and cannot easily move away if/when you site grows or needs more complexity? Just fair warning. Same for Wix, and similar "easy" sites creators. They sucker you in, and then do their best to never let you leave.

- Did my advice help you? Then become a Premium Member and support this site.
- Please Like Us on Facebook | Follow Us on Twitter

- Need a good web host? Ask me for help! Get the shared, VPS, semi-dedicated, cloud, or reseller you need.
Reply With Quote
  #11  
09-14-2016, 03:03 AM
karikuy karikuy is offline
Free Member
 
Join Date: Sep 2016
Posts: 6
Thanked 0 Times in 0 Posts
I thought it had fixed it now i don't know if it was a browser problem as it is back to not working I saw that in your code you had the same code twice so i deleted one

RewriteRule (.*) http://www.karikuy.com/$1 [L,R=301]

and to me it looked like it had worked, but now all the same errors again www.karikuy.org does not redirect, the rest of the site /itin /blog work
Reply With Quote
Reply




Similar Threads
Thread Thread Starter Forum Replies Last Post
A few quick .htaccess tips to secure WordPress kpmedia Website and Server Troubleshooting 2 09-04-2014 01:33 AM
How to park a domain in WHM? Brent Web Hosting 0 09-13-2013 06:34 PM
How to password protect a folder with .htaccess/.htpasswd kpmedia Website and Server Troubleshooting 0 10-18-2010 04:41 AM
Htaccess, ModRewrite, ISAPI Rewrite admin Website and Server Troubleshooting 0 08-12-2009 11:13 PM

Thread Tools



 
All times are GMT -5. The time now is 07:11 PM