Post by d3trading » Mon Mar 05, 2018 11:55 am

Hey Guys,

I copied my current installation of OC into a subdirectory /Shop/

I left the original installation in my root folder, because I want to make sure the subdirectory version is completely functional prior to deleting.

I changed both config.php files in /Shop and /Shop/Admin to reflect the subdirectory.

Now, when I go to http://mysite.com/Shop the store shows up perfectly and I can move to any category or product from the homepage and it reflects correctly. Ex: http://mysite.com/Shop/Category1 or http://mysite.com/Shop/Product1

BUT, when I click to move once on the above category or product pages, it redirects me back to the root installation. It doesn't matter if I move to another category, product or back to the home page, it sends me to the root install.

Why do the links work on the Home page, but once I go a level deep, it reverts back to root?

Newbie

Posts

Joined
Wed Aug 16, 2017 6:35 am

Post by IP_CAM » Mon Mar 05, 2018 12:10 pm

You probably still need to rewrite the REWRITE ENGINE path in the .htaccess
File of your new Shop Sub, to match the new Subdirectory:
Ernie

Code: Select all

# SEO URL Settings
RewriteEngine On
RewriteBase /yournewshopsub/

My Github OC Site: https://github.com/IP-CAM
5'200 + 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

Post by d3trading » Mon Mar 05, 2018 12:23 pm

I tried that earlier, but still giving me fits. Did I miss anything?



.htaccess file


AddHandler application/x-httpd-php54 .php55 .php

# 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
RewriteCond %{HTTP_HOST} ^www.thewalletshoppe.com/ [nocase]
RewriteRule ^(.*) http://thewalletshoppe.com/$1 [last,redirect=301]

# 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
RewriteBase /Shop/

# If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/

RewriteBase /Shop/
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]

#Modification start by Justin Dobbs. DO NOT DELETE OR SUB STORES STOP WORKING
RewriteCond %{REQUEST_URI} !^/Shop/.*$
#Modification finished by Justin Dobbs. DO NOT DELETE OR SUB STORES STOP WORKING

### 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
## INCREASE PAGE SPEED HTACCESS MODIFICATION ##
<ifModule mod_headers.c>
Header set Connection keep-alive
</ifModule>
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/x-javascript
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
<ifModule mod_headers.c>
Header append Vary User-Agent
</ifModule>
## END INCREASE PAGE SPEED HTACCESS MODIFICATION ##

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

Newbie

Posts

Joined
Wed Aug 16, 2017 6:35 am

Post by IP_CAM » Mon Mar 05, 2018 7:35 pm

Well, your .htaccess file is a mess, you have different rewrite Engine Commands,
one of them directs to the Site ROOT, and the others to a Shop/ Directory ::)
And that WORDPRESS Content has nothing to do in an OC .htaccess file either!
Try the one below, it is to be placed in the yoursite.com/Shop/ Directory, and
with the setting as shown, the Shop needs to be called by http:// www. yoursite/Shop/
Ernie
---

Code: Select all

<Files .htaccess>
order allow,deny
deny from all
</Files>

LimitRequestBody 750000

Options +SymLinksIfOwnerMatch

# Prevent Directory listing 
Options -Indexes

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

# disable etags
FileETag none

# 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 /Shop/

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

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]
RewriteRule ^system/(.*) /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]

# Enable Gzip Compression
AddOutputFilterByType DEFLATE text/text
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript

# Leverage Browser Caching
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType text/x-javascript "access plus 1 month"
ExpiresByType application/x-shockwave-flash "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresDefault "access plus 1 month"
</IfModule>

#<IfModule mod_headers.c>
#Header always set X-FRAME-OPTIONS "DENY"
#</IfModule>

<IfModule mod_headers.c>
Header always set X-XSS-Protection "1; mode=block"
</IfModule>

<IfModule mod_headers.c>
Header always set X-Content-Type-Options "nosniff"
</IfModule>

# Remove Browser Bugs
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent

My Github OC Site: https://github.com/IP-CAM
5'200 + 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

Post by d3trading » Mon Mar 05, 2018 10:01 pm

I am going to be running Wordpress as my "main" site, but both OC and WP are installed in subfolders. i.e., I only want OC to be accessible from the "Shop" link at my WP site. Also, my site has redirected to non www since 2013, I am afraid it will mess things up pretty bad if I switch things around?

Newbie

Posts

Joined
Wed Aug 16, 2017 6:35 am

Post by d3trading » Mon Mar 05, 2018 11:21 pm

Ok, your .htaccess works great...everything within the /Shop subdir. is linking and staying within /Shop.

But...now I'm getting this error and cannot log in to my Admin:

Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/MYSITE/public_html/Shop/system/database/mysql.php on line 6

Any ideas?

Newbie

Posts

Joined
Wed Aug 16, 2017 6:35 am

Post by IP_CAM » Mon Mar 05, 2018 11:37 pm

I know, it works great, I use it in all my Test Shops! :laugh:
You have to change BOTH config.php file DB Lines to look like this:
// DB
define('DB_DRIVER', 'mysqli');

and your Shop will then be remarkably faster too. And if it works, you only need
to use the File, packed in the ZIP, and to be placed into and called from the SHOP Directory,
in order to fully index your DB, and to change the DB Engine from MyIsam to InnoDB.
Then, your shop will work like never before. ;)
Ernie

My Github OC Site: https://github.com/IP-CAM
5'200 + 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

Post by d3trading » Tue Mar 06, 2018 12:11 am

Ok, that removed the error being thrown on the front end, but when I try to log into the Admin, I still see this error code at the top and it will not allow me to actually log in...I get a blank white screen with this error code:

Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/MYSITE/public_html/Shop/system/database/mysql.php on line 6

Newbie

Posts

Joined
Wed Aug 16, 2017 6:35 am

Post by d3trading » Tue Mar 06, 2018 1:14 am

Got it sorted out, thanks!!

#USERERROR

Newbie

Posts

Joined
Wed Aug 16, 2017 6:35 am

Post by IP_CAM » Tue Mar 06, 2018 2:46 am

Good for you, you probably only forgot, that the Admin config.php
File mysql line needs to be rewitten to mysqli too... :D
Good Luck! ;)
Ernie

My Github OC Site: https://github.com/IP-CAM
5'200 + 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 47 guests