Post by LawrenceS122 » Sat Oct 24, 2015 3:37 am

Hello,

I have opencart 1.5.4.1 and am trying to enable the seo. I have asked my host provider who say the apache mod-rewrite is on by default.

I understand I have to rename the htaccess.txt to just htaccess. My site is in the root and not any subfolder.

When I looked in my root folder there were two files htaccess and htaccess.txt.

Here are what the files look like starting with 1. htaccess.txt:

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

# Prevent Directoy listing 
Options -Indexes

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

# 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 /
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [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]

### Additional Settings that may need to be enabled for some servers 
### Uncomment the commands by removing the # sign in front of it.
### If you get an "Internal Server Error 500" after enabling any of the following settings, restore the # as this means your host doesn't allow that.

# 1. If your cart only allows you to add one item at a time, it is possible register_globals is on. This may work to disable it:
# php_flag register_globals off

# 2. If your cart has magic quotes enabled, This may work to disable it:
# php_flag magic_quotes_gpc Off

# 3. Set max upload file size. Most hosts will limit this and not allow it to be overridden but you can try
# php_value upload_max_filesize 999M

# 4. set max post size. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value post_max_size 999M

# 5. set max time script can take. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value max_execution_time 200

# 6. set max time for input to be recieved. Uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value max_input_time 200

# 7. disable open_basedir limitations
# php_admin_value open_basedir none
here is what the second htaccess file looks like

Code: Select all

RewriteEngine on

RewriteCond %{HTTP_HOST} ^mysite\.co\.uk$ [OR]
RewriteCond %{HTTP_HOST} ^www\mysite\.co\.uk$
RewriteRule ^silvercare\/?$ "http\:\/\/mysite\.co\.uk\/safteydeclaration\/SAFTEY\ DECLARATION\.pdf" [R=301,L]

I looked on a guide (http://omframework.com/2014/11/25/how-t ... ncart/)and they said rename the htaccess.txt file and add this code:

Code: Select all

# 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 /
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteRule ^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]
I did this and deleted the other htaccess file and then I got a 404.
I tried also doing their next suggestion which was to download their htaccess file and I deleted those that were on my site and uploaded theirs.

Still getting 404 when you click on a product which has the seo filled out.

I just put the old files back and turned seo off until I know what to do.

Any advice is warmly welcomed.

Lorry

Newbie

Posts

Joined
Sat Oct 24, 2015 3:25 am

Post by IP_CAM » Sat Oct 24, 2015 8:50 pm

the OC .htaccess.txt is the same as .htaccess, basically, it just has been DISABLED, by DEFAULT, by ADDING .TXT at the end, in order to get a Shop working, WITHOUT eventually NO YET, or incorrectly SET specifications/paths/restrictions, usually defined/set, in a .htaccess File.

In addition, to USE/ENABLE .htaccess, some LINKS have to be SET, depending of the individual Server installation, and the Server PATH, used, where the Shop Software has been placed:
Sample:

Code: Select all

# If using subdirectory, update RewriteBase /
# IF Store URL: www.ipc.li/shop/....
# THEN, Update to: RewriteBase /shop/
# SEO URL Settings
RewriteEngine On
RewriteBase /shop/
More, to be able to use SEO, each and every THING (SEO-LINK-NAME) has to be NAMED, correctly, by use of ONE_WORD_SEO_Titles_ONLY, without any WHITE SPACES, in between MULTIPLE_WORDS, like MULTIPLE WORDS, to make SEO work, in the first place.

Get it? :D
Ernie

My Github OC Site: https://github.com/IP-CAM
5'600 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland
Who is online

Users browsing this forum: No registered users and 2 guests