Post by zugu » Sat Jan 15, 2011 7:20 pm

Hello,


I'm using OpenCart v1.4.9.3 on a generic Linux webhost. I have some SEO stuff to do, and I can't figure it at all.

I need to redirect the following URLs:

Code: Select all

http://examplestore.com/index.php?route=common/home
http://examplestore.com/index.php
http://examplestore.com
http://www.examplestore.com/index.php?route=common/home
http://www.examplestore.com/index.php
to

Code: Select all

http://www.examplestore.com
I've been creating 301 redirects using CPanel, but it always ends up badly. For example:

Redirecting

Code: Select all

http://examplestore.com/index.php
to

Code: Select all

http://examplestore.com
works, but pretty product URLs are broken in the process:

Code: Select all

http://examplestore.com/category/product
becomes

Code: Select all

http://examplestore.com/?_route_=category/product
Any ideas?

Newbie

Posts

Joined
Sat Jan 15, 2011 6:50 pm

Post by Delta-DK » Sun Jan 16, 2011 9:49 pm

If i understand you right, you need a redirect link from the specific pages?
If the pages exist, put this script in

<script type="text/javascript">
window.location.href="http://www.example.com/";
</script>

If that isnt your problem, please write me

Danish independent web integrator, graphic and SEO Developer
HTML, CSS 2.0 + 3.0, Javascript, XML, ActionScript 2.0 + 3.0 & basic PHP / MySQL


Newbie

Posts

Joined
Fri Jan 14, 2011 9:12 am


Post by SapporoGuy » Sun Jan 16, 2011 11:26 pm

Could be a conflict between htaccess and php.ini
Check those.

I doubt if I'd use javascript for server side rewrites.

930sc ... because it is fun!


User avatar
Active Member

Posts

Joined
Mon Nov 01, 2010 7:29 pm

Post by jcgadgets » Tue Jan 18, 2011 2:58 pm

Hey zugu,

I've just been battling this same thing. I had absolutely no luck with cPanel's 301 redirects...found them useless, though I can't say why they had no effect.

What I did was went into my .htacess file and set up all of the redirects from there.

I have these entries (among others) in my robots.txt file (nothing to do with redirects, but can help a lot with SEO - especially if you have SEO URL's enabled):
User-agent: *
Disallow: /*?sort
Disallow: /*&sort
Disallow: /*?route=checkout/
Disallow: /*?route=account/
Disallow: /*?route=product/search
Disallow: /*?page=1
Disallow: /*&create=1
Disallow: /*route=information/information*
Disallow: /*route=product/*
Disallow: /*route=common/home
Disallow: /*route=product/manufacturer&manufacturer_id=8
Allow: /

An example of part of my .htaccess:
# SEO URL Settings
RewriteEngine On
RewriteBase /StoreFront/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]

RewriteCond %{QUERY_STRING} ^route=common/home$
RewriteCond %{REQUEST_METHOD} !^POST$
RewriteRule ^index\.php$ http://www.site.com/StoreFront? [R=301,L]

RewriteCond %{QUERY_STRING} ^$
RewriteCond %{REQUEST_METHOD} !^POST$
RewriteRule ^index\.php$ http://www.site.com/StoreFront? [R=301,L]

This gets all of the URL's you wanted to redirect to go to:
http://www.site.com/StoreFront/

I just tested each one.
All of my product and category URL's have remained pretty.

**Big credits to Chones for teaching me just about all of this.


Good luck!
Thank you,
Jared

Active Member

Posts

Joined
Sun Oct 31, 2010 4:49 pm

Post by anilrmg » Thu Feb 24, 2011 5:36 pm

unable to redirect . the message come page not found

opencart.com/index.php?route=checkout/cart
to
opencart.com/index.php/cart

opencart.com/index.php?route=account/login
to
opencart.com/index.php/login


index.php?route=common/home
to
index.php/home

Newbie

Posts

Joined
Thu Feb 24, 2011 3:07 am

Post by jcgadgets » Sat Feb 26, 2011 8:38 am

Can you show us exactly how you are trying to do the redirects? Show us your code?

Either way, I wouldn't worry about the login page or the cart page. No one will be Googling for the word "cart" or "login" that will bring your page up anyway. Unless those words are somehow specially relevant to your products, it won't do you much good. Not to mention the fact that those words are already in the default URL.

As for the home one, it's giving a page not found error because there is no page called home. It's called index. If you want to try to clean that URL up, just have it redirect to www.yoursite.com/


Thank you,
Jared

Active Member

Posts

Joined
Sun Oct 31, 2010 4:49 pm

Post by philbydevil » Sat Feb 26, 2011 1:47 pm

Here's how I did my 301 redirects: http://forum.opencart.com/viewtopic.php?f=20&t=24877

To clean up my homepage, I used this in .htaccess:

Code: Select all

# SEO homepage - One currency
RewriteCond %{QUERY_STRING} ^route=common/home$
RewriteRule ^index\.php$ http://www.yoursite.com? [R=301,L]
Or:

Code: Select all

# SEO homepage - Multiple currencies
RewriteCond %{QUERY_STRING} ^route=common/home$
RewriteCond %{REQUEST_METHOD} !^POST$
RewriteRule ^index\.php$ http://www.yoursite.com? [R=301,L] 

I heart cmd-f, cmd-c, cmd-v, cmd-z + vQmod.
My favourite page...
v1.5.4.1


User avatar
Active Member

Posts

Joined
Fri Dec 03, 2010 5:20 am

Post by jcgadgets » Sat Feb 26, 2011 3:11 pm

And what exactly is the problem? I'm not sure how to help you with the cart and login pages. The home page should work just by the things I've already posted in this thread, which are these:

Code: Select all

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

RewriteCond %{QUERY_STRING} ^route=common/home$
RewriteCond %{REQUEST_METHOD} !^POST$
RewriteRule ^index\.php$ http://www.site.com/? [R=301,L]

RewriteCond %{QUERY_STRING} ^$
RewriteCond %{REQUEST_METHOD} !^POST$
RewriteRule ^index\.php$ http://www.site.com/? [R=301,L]

Thank you,
Jared

Active Member

Posts

Joined
Sun Oct 31, 2010 4:49 pm

Post by philbydevil » Sat Feb 26, 2011 3:59 pm

Oops... I didn't see those posted above.

I heart cmd-f, cmd-c, cmd-v, cmd-z + vQmod.
My favourite page...
v1.5.4.1


User avatar
Active Member

Posts

Joined
Fri Dec 03, 2010 5:20 am

Post by jcgadgets » Sun Feb 27, 2011 9:35 am

I see. So did those work out ok for you?


Thank you,
Jared

Active Member

Posts

Joined
Sun Oct 31, 2010 4:49 pm

Post by philbydevil » Sun Feb 27, 2011 10:55 am

Hey Jared, um... I wasn't actually the one asking the question, but your redirects should have worked.

I think this is where they are having problems:
anilrmg wrote:unable to redirect . the message come page not found

opencart.com/index.php?route=checkout/cart
to
opencart.com/index.php/cart

opencart.com/index.php?route=account/login
to
opencart.com/index.php/login


index.php?route=common/home
to
index.php/home
I haven't dealt with this myself, but think I remember seeing it somewhere before. Maybe anilrmg can do a search.

I heart cmd-f, cmd-c, cmd-v, cmd-z + vQmod.
My favourite page...
v1.5.4.1


User avatar
Active Member

Posts

Joined
Fri Dec 03, 2010 5:20 am

Post by jcgadgets » Sun Feb 27, 2011 11:32 am

Oh, right, sorry. I just asked:
Can you show us exactly how you are trying to do the redirects? Show us your code?
and then you responded saying how you did yours, so I got confused :)

Hopefully anilrmg works it out!


Thank you,
Jared

Active Member

Posts

Joined
Sun Oct 31, 2010 4:49 pm
Who is online

Users browsing this forum: No registered users and 43 guests