Post by AdieB » Fri Feb 23, 2024 5:58 pm

I am using OC 2.3.0.2 and have been battling to get the SEO URL's to work. I have followed this useful guide, and believe the problem lies in my .htaccess file. Does anybody have a sample .htaccess that I may have a look at to try determine where I am going wrong.
Guide - courtesy of CHATGPT:-

# What are the steps in Opencart 2.3.0.2 to create useful URL's
Opencart 2.3.0.2 provides the option to enable SEO URLs for a more user-friendly and search engine optimized website. Here are the steps:

Login to Admin Panel:
Log in to your Opencart admin panel.

Navigate to System Settings:
Go to "System" in the top menu, then select "Settings."

Edit Store Settings:
Inside the "Settings" section, find and click on the "Edit" button for your store.

Enable SEO URLs:
In the "Server" tab, set "Use SEO URLs" to "Yes."

Save Changes:
Save the changes made to the store settings.

Modify .htaccess:
Ensure that your server's .htaccess file is properly configured to support SEO URLs. Opencart often provides a default .htaccess file for this purpose.

Check SEO URL Structure:
Verify the structure of your SEO URLs by visiting your storefront. URLs should now be more readable and optimized.

AND my .htaccess file:-

Options +FollowSymlinks
Options -Indexes
<FilesMatch "(?i)((\.tpl|\.ini|\.log|(?<!robots)\.txt))">
Require all denied
</FilesMatch>
RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*) https://www.ic-express.co.za%{REQUEST_URI} [R=301,L,NE]
RewriteBase /
# RewriteRule ^sitemap.xml$ index.php?route=extension/feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=extension/feed/google_base [L]
RewriteRule ^system/download/(.*) index.php?route=error/not_found [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php [L,QSA]

New member

Posts

Joined
Mon May 19, 2014 9:01 pm

Post by ADD Creative » Fri Feb 23, 2024 6:42 pm

The default .htaccess is below. You just need to rename it from .htaccess.txt to .htaccess. Your rewrite to index,php is missing the route.

https://github.com/opencart/opencart/bl ... access.txt

www.add-creative.co.uk


Guru Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by paulfeakins » Fri Feb 23, 2024 8:27 pm

This should help:
https://www.antropy.co.uk/blog/how-to-h ... -opencart/

If not, make sure your host has mod_rewrite enabled.

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Legendary Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by AdieB » Fri Feb 23, 2024 11:07 pm

Are there any issues using localhost, Wampserver Apache and windows based - not working using default .htaccess and mod_rewrite enabled.
I haven't tried on a live site yet, as I wanted to get working on Localhost first.

New member

Posts

Joined
Mon May 19, 2014 9:01 pm

Post by OSWorX » Fri Feb 23, 2024 11:17 pm

AdieB wrote:
Fri Feb 23, 2024 11:07 pm
Are there any issues using localhost, Wampserver Apache and windows based - not working using default .htaccess and mod_rewrite enabled.
I haven't tried on a live site yet, as I wanted to get working on Localhost first.
NO, if the base url ist set correct, it should work.
Verify that RewriteBase / is pointing to your installation.

p.s.: and what for you need CHATGPT ? ?

Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.


User avatar
Administrator

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria

Post by AdieB » Fri Feb 23, 2024 11:48 pm

These are my SE|O URL Settings:
# SEO URL Settings
RewriteEngine On
# If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/

RewriteBase /wamp64/www
RewriteRule ^sitemap.xml$ index.php?route=extension/feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=extension/feed/google_base [L]
RewriteRule ^system/download/(.*) index.php?route=error/not_found [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]

Installation is in c:\wamp64

New member

Posts

Joined
Mon May 19, 2014 9:01 pm

Post by OSWorX » Sat Feb 24, 2024 12:54 am

AdieB wrote:
Fri Feb 23, 2024 11:48 pm

Code: Select all

RewriteBase /wamp64/www
Guess your installation is (of course) inside the folder wamp64.
And www is your default folder for all webs (as all installations have to be copied inside this folder).
So, the final line should then be: RewriteBase /

The default folder for all webs in WAMPP will be c:\wamp\www (or any other disk like d:\ or e:\)
And you will call then your instance by http(s)://localhost
If it's a subfolder it will be http(s)://localhost/webs/shop1 > the line then would be RewriteBase /webs/shop1

Quite easy and foolproof ...

But if your installation is for example inside the folder webs, the line should be RewriteBase /webs.

Same with XAMPP, where all websites reside inside the folder htdocs > RewriteBase /

Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.


User avatar
Administrator

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria

Post by AdieB » Mon Feb 26, 2024 6:22 pm

Still battling. If SEO URL's are enabled in Admin backend, and one edits a Product to add a SEO field, should the SEO edit menu be available in the edit product dropdown menus? It is available in the Data dropdown menu, but all tutorials I have read show it as one of the main headings.
I am thinking that once you add the ability of using SEO URL's, it then adds another dropdown menu, which mine isn't doing, possibly indicating that the Enable may not be functioning?
Hope this makes sense.

New member

Posts

Joined
Mon May 19, 2014 9:01 pm

Post by ADD Creative » Mon Feb 26, 2024 6:48 pm

There are no edit product dropdown menus in OpenCart. Can you explain more details?

www.add-creative.co.uk


Guru Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by AdieB » Mon Feb 26, 2024 6:52 pm

If you look at this tutorial,
https://www.antropy.co.uk/blog/how-to-h ... -opencart/
and scroll down, you will see the image of the product edit, which includes the SEO dropdown I mention. The tutorial doesn't mention the OC version however.

New member

Posts

Joined
Mon May 19, 2014 9:01 pm

Post by paulfeakins » Mon Feb 26, 2024 8:35 pm

AdieB wrote:
Fri Feb 23, 2024 11:07 pm
Are there any issues using localhost, Wampserver Apache and windows based - not working using default .htaccess and mod_rewrite enabled.
I haven't tried on a live site yet, as I wanted to get working on Localhost first.
I wouldn't recommend developing on localhost like this. It's better to use a server that's very similar to your live environment.

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Legendary Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by ADD Creative » Mon Feb 26, 2024 11:23 pm

AdieB wrote:
Mon Feb 26, 2024 6:52 pm
If you look at this tutorial,
https://www.antropy.co.uk/blog/how-to-h ... -opencart/
and scroll down, you will see the image of the product edit, which includes the SEO dropdown I mention. The tutorial doesn't mention the OC version however.
That isn't a dropdown, it's on the SEO tab. However, you won't find a SEO tab in OpenCart 2. As the tutorial says.
Note: OpenCart 1 & 2 - the SEO keyword for products and categories are under the 'Data' tab, named 'SEO Keyword'.
You need to click on 'Data' and scroll down until you see 'SEO URL'.

www.add-creative.co.uk


Guru Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by AdieB » Tue Mar 12, 2024 7:17 pm

Could the version of PHP cause this problem in your experience. I am using v7.4? ISP confirms mod_rewrite is enabled.

New member

Posts

Joined
Mon May 19, 2014 9:01 pm

Post by ADD Creative » Tue Mar 12, 2024 8:23 pm

The version of PHP is unlikely to be an issue unless you are seeing errors in your PHP and OpenCart error logs.

www.add-creative.co.uk


Guru Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom
Who is online

Users browsing this forum: No registered users and 40 guests