Post by asphole » Thu Aug 18, 2011 7:18 pm

Apologies if this is in the wrong forum. (Mods, please feel free to move if it is)

I have multi-store running on v1.5.1 and am about to add one of my main stores as an add-on domain but I've realised that unless I match the new url's to the old google listed url's I will lose the listing in google. (Not good!)

So my question is: Is there any way to redirect a sub-store using a 301 redirect when I'm using an add-on domain?

Just to clarify my set up, I have:

DomainA (Main cpanel account)
DomainB (Add-on domain from DomainA cpanel)

I want the old google links pointing to domainB url's to redirect to DomainB new url's.

I tried using:
redirect 301 /old-google-url-p-109.html http://domainB/new-OC-url.html

As the htaccess is in the root of DomainA this doesnt work.

Any ideas if this can be done? (I can export my products and make the new url's match the old url's but this will take forever with thousands of products and the old zen url's are horrible!) a 301 will definitely be the easiest option if possible?

Hope that makes sense?

Active Member

Posts

Joined
Mon Mar 14, 2011 9:33 am

Post by fido-x » Thu Aug 18, 2011 7:32 pm

Try putting the following in your .htaccess file:

Code: Select all

Redirect permanent /old-google-url-p-109.html http://domainB/new-OC-url.html  
and see if that works.

Image
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool

If you're not living on the edge ... you're taking up too much space!


User avatar
Expert Member

Posts

Joined
Sat Jun 28, 2008 1:09 am
Location - Tasmania, Australia

Post by asphole » Thu Aug 18, 2011 7:39 pm

Hi Fido-x,

Thank you for the quick reply. I think you're onto something! It does now redirect to the correct site and url. Unfortunately it is appending the route to the url once redirected.

eg: http://www.DomainB.co.uk/New-Url?_route_=Old-URL

Is there anyway to get rid of the end part?

Active Member

Posts

Joined
Mon Mar 14, 2011 9:33 am

Post by asphole » Thu Aug 18, 2011 7:40 pm

Also have 'Use SEO URL's:' enabled if that makes any difference?

Active Member

Posts

Joined
Mon Mar 14, 2011 9:33 am

Post by fido-x » Thu Aug 18, 2011 7:55 pm

asphole wrote:Also have 'Use SEO URL's:' enabled if that makes any difference?
I thought so. It probably does make a difference, since you're getting "_route_" in the redirect. Does it work with SEO turned off?

Image
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool

If you're not living on the edge ... you're taking up too much space!


User avatar
Expert Member

Posts

Joined
Sat Jun 28, 2008 1:09 am
Location - Tasmania, Australia

Post by asphole » Thu Aug 18, 2011 8:05 pm

No, Just tried it without seo enabled and back to page not found with browser showing old url.

I changed htaccess to show new no seo enabled url ( /index.php?route=product/product&path=1_25&product_id=1042) and that didnt work either. grrrr!! I HATE things I dont understand!! ???

Active Member

Posts

Joined
Mon Mar 14, 2011 9:33 am

Post by asphole » Thu Aug 18, 2011 8:10 pm

Sorry it does work with SEO disabled. (typo in my url) Does that mean i cant use seo url's?

Active Member

Posts

Joined
Mon Mar 14, 2011 9:33 am

Post by uksitebuilder » Thu Aug 18, 2011 8:16 pm

see -> http://forum.opencart.com/viewtopic.php?f=20&t=38821

The guy hasn't got back on that thread either but wont hurt to try I guess

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by asphole » Thu Aug 18, 2011 8:44 pm

uksitebuilder, You're a star mate!!! That worked a treat and is definitely going to save a lot of dropped links or rewriting urls to the old crappy zen ones!

I was concerned that I would lose all the listings for my main site and we have a lot of page 1 rankings so was very hesitant about moving it to oc but that has done the trick.

One more question I have is whether this could be duplicated in someway on a per domain basis?

ie:
redirect domainB old url to domainB new url
AND
redirect domainC old url to domainC new url
AND
redirect domainD old url to domainD new url

No problems if it cant be done as my main concern was DomainB but it would be nice not to lose any rankings on DomainC,D,E etc.

Anyway, whatever the outcome for last question, thanks so much for your help on resolving my original one!

Active Member

Posts

Joined
Mon Mar 14, 2011 9:33 am

Post by asphole » Thu Aug 18, 2011 11:06 pm

Apologies, thanks also to Fido-x.

Active Member

Posts

Joined
Mon Mar 14, 2011 9:33 am

Post by uksitebuilder » Thu Aug 18, 2011 11:08 pm

So you have the same URLs on DomainB and DomainC etc - Identical apart from the domain ?

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by asphole » Thu Aug 18, 2011 11:18 pm

Yes all the old domain url's are Identical apart from the domain.

Active Member

Posts

Joined
Mon Mar 14, 2011 9:33 am

Post by uksitebuilder » Fri Aug 19, 2011 2:08 am

I believe it should be as easy as prefixing the 2nd part of the rule with http://%{HTTP_HOST}

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by asphole » Fri Aug 19, 2011 3:35 am

Simon, You're a legend mate!! Absolutely spot on and works a treat on all domains!!

Just to recap the exact code I'm using for any others in the same position:

RewriteRule ^old-url.html$ http://%{HTTP_HOST}new-url.html? [R=301,L]

I seriously can't thank you enough mate. This was causing me a serious headache and I was getting worried I would lose some rankings on a few existing sites but this should certainly minimize any loss of position.

Thanks again, I really appreciate your patience and taking the time to help.

Cheers ;D

Active Member

Posts

Joined
Mon Mar 14, 2011 9:33 am

Post by uksitebuilder » Fri Aug 19, 2011 4:08 am

I think you may need a forward slash before 'new-url' not 100% though.

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by asphole » Fri Aug 19, 2011 4:12 am

Oops yes you're right. It has the / in my .htaccess, I just accidentally deleted it when pasting the code here.

Code is: RewriteRule ^old-url.html$ http://%{HTTP_HOST}/new-url.html? [R=301,L]

Thanks again for all your help.

Active Member

Posts

Joined
Mon Mar 14, 2011 9:33 am

Post by asphole » Wed Aug 24, 2011 6:57 pm

I've just noticed an odd issue with my url's and wonder if anyone can see the problem?

I am using the following code:

RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]

RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

This appears to work for most links, however, some links (Login/Create Account/My Account/Checkout etc) show the following url: www.domain.co.uk/://index.php/seo-url

'://index.php/seo-url' added to end of rewritten url

The visitor still reaches the page they clicked on but the url is obv wrong.

With seo urls off the links look normal so I am guessing it is the htaccess.

Any ideas?

Active Member

Posts

Joined
Mon Mar 14, 2011 9:33 am

Post by uksitebuilder » Wed Aug 24, 2011 7:40 pm

Is this happening on the main domain or on a multi-store domain?

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by uksitebuilder » Wed Aug 24, 2011 7:59 pm

I just looked on a client's domain who uses multi-store and the same strange behaviour is evident there also, but only on the multi-store domain names, not the main domain name.

This is not a .htaccess problem, but rather a problem with how the links in the site are written.

.htaccess converts what is sent to the server (from a SEO URL to an original path - index.php?route=...)

I will investigate

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by asphole » Wed Aug 24, 2011 8:39 pm

Yes same here, Just the multi store domains. I hadn't notice before as some worked ok so I guess I just didn't check all of them.

Active Member

Posts

Joined
Mon Mar 14, 2011 9:33 am
Who is online

Users browsing this forum: No registered users and 123 guests