Post by moggiex » Mon Nov 09, 2009 9:59 pm

Howdy,

Looking at this post http://forum.opencart.com/viewtopic.php ... ess#p35253 the owner has it working for products, however all I get is:

http://www.url.com/category/subcategory?product_id=91

Instead of the likes of:
http://www.laptopbatterybuy.com/hp-comp ... 00-battery

Can someone point me in the right direction to get friendly URL's working for products?

Note: I am using 1.3.2 and my current .htaccess rules are:

Code: Select all

Options +FollowSymlinks

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

# Added for non www queries
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule (.*) http://www.%{HTTP_HOST}/store/$1 [R=301,L]
Kind regards,

Matt

Code: Select all

It was like that when I found it, honest!


User avatar
Active Member

Posts

Joined
Mon Nov 09, 2009 9:55 pm

Post by expertmarketer » Sat Nov 28, 2009 2:03 am

Just some suggestions:

1. Make sure you rename the file to .htaccess, not .htaccess.txt
2. Make sure other, basic htaccess rules work and that your server has this enabled. It's not on by default, but should be if you are in a shared environment If a basic rule works, then you can progress to more advanced rules
3. Make sure you've restarted the apache server if you've made changes to it. Though the .htaccess should not require a reboot - but enabling it will.

Wish I could help more.


Posts

Joined
Sat Nov 28, 2009 1:59 am

Post by hubba » Wed Dec 02, 2009 12:28 pm

Do you have your store in a subdirectory?

For example:

http://www.yourdomain.com/store

if you do, you have to make sure that you update the .htaccess file with the right directory (see what I have marked in RED below)

---.htaccess file start ----

Options +FollowSymlinks

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

# Added for non www queries
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule (.*) http://www.%{HTTP_HOST}/store/$1 [R=301,L]
---.htaccess file ends ----

of course I would assumed that you have already renamed ".htaccess.txt" to ".htaccess" and also set the options correctly in your store setup to use friend seo links.

New member

Posts

Joined
Mon Sep 07, 2009 1:13 am

Post by amnon » Sun Dec 13, 2009 5:07 pm

For what it's worth, on my FreeBSD machine, to get SEO url's working I also needed to amend the httpd.conf with the line:

AllowOverride FileInfo

in the opencart <Directory> section.

Amnon

New member

Posts

Joined
Wed Dec 09, 2009 10:46 pm

Post by moggiex » Mon Dec 14, 2009 9:42 pm

Ah I realised this ages ago, products and categories need the SEO name filling out in them ::) ::) ::) ::) ::)

Matt

Code: Select all

It was like that when I found it, honest!


User avatar
Active Member

Posts

Joined
Mon Nov 09, 2009 9:55 pm

Post by adelaida » Sat Mar 06, 2010 10:23 pm

it is impossible to implement SEO urls only through .htaccess
it should be inside the engine

opencart shopping saved lots of time for me!
thank you! just another situk mind (c)
simply clear uk granny dating website


Newbie

Posts

Joined
Fri Feb 19, 2010 8:17 pm

Post by Grissom » Wed Jul 07, 2010 11:04 pm

@adelaida:

It actually IS possible...as I just did with my OC shop. Here's my htaccess content:

Code: Select all

# 1.To use URL Alias you need to be running apache with mod_rewrite enabled. 

# 2. In your opencart directory rename htaccess.txt to .htaccess.

# For any support issues please visit: http://www.opencart.com

Options +FollowSymLinks
RewriteEngine on


# Prevent Directoy listing 
Options -Indexes

# Prevent Direct Access to files
<FilesMatch "\.tpl">
Order deny,allow
Deny from all
</FilesMatch>

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

# Added for non www queries
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule (.*) http://www.%{HTTP_HOST}/shop/$1 [R=301,L]
Hope this helps others!

Chris

Newbie

Posts

Joined
Sun Jul 04, 2010 2:17 am

Post by HTMLCSSNoob » Thu Sep 02, 2010 6:29 pm

hubba wrote:---.htaccess file start ----

Options +FollowSymlinks

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

# Added for non www queries
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule (.*) http://www.%{HTTP_HOST}/store/$1 [R=301,L]
---.htaccess file ends ----

of course I would assumed that you have already renamed ".htaccess.txt" to ".htaccess" and also set the options correctly in your store setup to use friend seo links.
I updated my .htaccess file to look like as you mentioned above because I wanted to direct non www queries to www.

I have a question though. When I am in my website and I click on a product, or when I search using the www prefix, the friendly URLs look good (ex: http://www.mydomain.com/subfolder/friendly-url

But, if I search for http://mydomain.com/subfolder/friendly-url from the search bar, then it redirects me to http: //www.mydomain.com/subfolder/index.php?_r ... ienldy-url

How should I rewrite the .htaccess file so that when making a non www query for a specific product, it will redirect the person to the SEO friendly url (without the "index.php?_route_=" part).

Thanks

Active Member

Posts

Joined
Fri Aug 20, 2010 7:53 am

Post by shimapi » Wed Sep 08, 2010 10:47 am

Grissom wrote:@adelaida:

It actually IS possible...as I just did with my OC shop. Here's my htaccess content:

Code: Select all

# 1.To use URL Alias you need to be running apache with mod_rewrite enabled. 

# 2. In your opencart directory rename htaccess.txt to .htaccess.

# For any support issues please visit: http://www.opencart.com

Options +FollowSymLinks
RewriteEngine on

# Prevent Directoy listing 
Options -Indexes

# Prevent Direct Access to files
<FilesMatch "\.tpl">
Order deny,allow
Deny from all
</FilesMatch>

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

# Added for non www queries
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule (.*) http://www.%{HTTP_HOST}/shop/$1 [R=301,L]
Hope this helps others!

Chris

Thank You very much!! That Works perfect for me!!
;)

Altorrelieve.cl


User avatar
Newbie

Posts

Joined
Wed Sep 08, 2010 10:45 am


Post by HTMLCSSNoob » Thu Sep 16, 2010 3:23 am

How would I write the below code if my store was not in a subfolder? My store is just on my root domain.

Code: Select all

# Added for non www queries
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule (.*) http://www.%{HTTP_HOST}/shop/$1 [R=301,L]

Active Member

Posts

Joined
Fri Aug 20, 2010 7:53 am

Post by tubbles » Fri Nov 04, 2011 8:52 am

HTMLCSSNoob wrote:
hubba wrote:---.htaccess file start ----

Options +FollowSymlinks

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

# Added for non www queries
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule (.*) http://www.%{HTTP_HOST}/store/$1 [R=301,L]
---.htaccess file ends ----

of course I would assumed that you have already renamed ".htaccess.txt" to ".htaccess" and also set the options correctly in your store setup to use friend seo links.
I updated my .htaccess file to look like as you mentioned above because I wanted to direct non www queries to www.

I have a question though. When I am in my website and I click on a product, or when I search using the www prefix, the friendly URLs look good (ex: http://www.mydomain.com/subfolder/friendly-url

But, if I search for http://mydomain.com/subfolder/friendly-url from the search bar, then it redirects me to http: //www.mydomain.com/subfolder/index.php?_r ... ienldy-url

How should I rewrite the .htaccess file so that when making a non www query for a specific product, it will redirect the person to the SEO friendly url (without the "index.php?_route_=" part).

Thanks
Just wondering if there is an answer to this? I seem to be having the same issue.

Newbie

Posts

Joined
Sat Jul 16, 2011 5:12 pm

Post by tubbles » Sat Nov 05, 2011 4:58 pm

Just in case anyone has the same issue (when clicking on a link that should have a seo was showing up as http://www.mydomain.com/subfolder/index ... ienldy-url instead of mydomain.com/subfolder/friendly-url_mydomain.com/subfolder/friendly-url) . I ended up disabling
# Added for non www queries
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule (.*) http://www.%{HTTP_HOST}/store/$1 [R=301,L]

And it all works perfectly (as I was also having issues trying to login to the admin side).

Newbie

Posts

Joined
Sat Jul 16, 2011 5:12 pm

Post by inspirio » Fri Feb 17, 2012 9:15 pm

Hi. This is that i made by reading this post:
http://stackoverflow.com/questions/7578 ... n-opencart
After that everything work 100%.
I made only one step of this:

Code: Select all

INSERT INTO `url_alias` (`url_alias_id`, `query`, `keyword`) VALUES
(NULL, 'checkout/cart', 'cart');
After that - 100% congrats. :)

Image


User avatar
New member

Posts

Joined
Fri Feb 17, 2012 9:11 pm

Post by ahimanshu » Wed Sep 23, 2020 1:07 pm

inspirio wrote:
Fri Feb 17, 2012 9:15 pm
Hi. This is that i made by reading this post:
http://stackoverflow.com/questions/7578 ... n-opencart
After that everything work 100%.
I made only one step of this:

Code: Select all

INSERT INTO `url_alias` (`url_alias_id`, `query`, `keyword`) VALUES
(NULL, 'checkout/cart', 'cart');
After that - 100% congrats. :)
is that supported with opencart Version 3.0.3.3

Regards
Himanshu


User avatar
Newbie

Posts

Joined
Mon Jul 10, 2017 10:55 am
Location - New Delhi

Post by johnp » Thu Sep 24, 2020 12:00 am

moggiex wrote:
Mon Nov 09, 2009 9:59 pm
Note: I am using 1.3.2 and my current .htaccess rules are:
Are there still 1.3.2 powered sites out there? Does it run ok?

Opencart 1.5.6.5/OC Bootstrap Pro/VQMOD 2.6.1 lover, user and geek.
Affordable Service £££ - Opencart Installs, Fixing, Development and Upgrades
Plus Ecommerce, Marketing, Mailing List Management and More
FREE Guidance and Advice at https://www.ecommerce-help.co.uk


User avatar
Active Member

Posts

Joined
Fri Mar 25, 2011 10:25 am
Location - Surrey, UK
Who is online

Users browsing this forum: No registered users and 11 guests