Post by ideep13 » Fri Aug 04, 2017 3:07 pm

I am trying to make my page site much better. I have an OC 2.1.0.1. Currently is all F if I check it under gtmetrix

I enabled mode security.. created seo links..

I have compression set to 8 under system (settings..) but gtmetrix still shows me that compression is not working?

How do I set my settings to A performance?

What can I do in .htaccess file to speed up the site?

And also redirection is also not working..

How to change following links? http://xxx.com/index.php?route=common/home

What am I doing wrong? Nothing works.

Code: Select all

RewriteEngine on
RewriteCond ${LeechProtect:/home/xx/public_html:%{REMOTE_USER}:%{REMOTE_ADDR}:4:IrAxFfga0idn1Hw7nrfbdfddfCW527UEX4k} leech
RewriteRule .* /
RewriteCond %{HTTP_HOST} ^[^.]+\.[^.]+$
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{36}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [L,R=301]
<Files 403.shtml>
order allow,deny
allow from all
</Files>

RewriteCond %{HTTP_USER_AGENT} libwww-perl.* 
RewriteRule .* ? [F,L]

RewriteCond %{HTTP_HOST} ^205\.251\.133\.82
RewriteRule (.*) http://www.xx/$1 [R=301,L]


RewriteCond %{HTTP_REFERER} !^http://xx/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://xx$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.xx/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.xx$      [NC]
RewriteCond %{HTTP_REFERER} !^https://xx/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^https://xx$      [NC]
RewriteCond %{HTTP_REFERER} !^https://www.xx/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^https://www.xx$      [NC]
RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]
ErrorDocument 404 /404.html

<FilesMatch "(?i)((\.tpl|\.ini|\.log|(?<!robots)\.txt))">
 Order deny,allow
 Deny from all
</FilesMatch>

# 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 "(?i)((\.tpl|.twig|\.ini|\.log|(?<!robots)\.txt))">
 Require all denied
## For apache 2.2 and older, replace "Require all denied" with these two lines :
# 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/

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

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/storage/(.*) 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]

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

ExpiresActive On
ExpiresDefault A0

<FilesMatch "\.(gif|jpg|jpeg|png|GIF|JPG|JPEG|PNG)$">
  ExpiresDefault A2592000
  Header append Cache-Control "public"
</FilesMatch>

<FilesMatch "\.(less|js|css|gz)$">
  ExpiresDefault A2592000
  Header append Cache-Control "proxy-revalidate"
</FilesMatch>

<FilesMatch "\.(php)$">
  ExpiresActive Off
  Header set Cache-Control "private, no-cache, no-store, proxy-revalidate, no-transform"
  Header set Pragma "no-cache"
</FilesMatch>

<IfModule mod_headers.c>
  <FilesMatch "\.(less|js|css|xml|gz)$">
    Header append Vary Accept-Encoding
  </FilesMatch>
</IfModule>

<IfModule mod_expires.c>
# Enable expirations
ExpiresActive On 
# Default directive
ExpiresDefault "access plus 1 month"
## EXPIRES CACHING ##
ExpiresByType image/jpg "access 1 month"
ExpiresByType image/jpeg "access 1 month"
ExpiresByType image/gif "access 1 month"
ExpiresByType image/png "access 1 month"
ExpiresByType text/css "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 week"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 month"
ExpiresDefault "access 1 month"
</IfModule>
## EXPIRES CACHING ##

# gzip #
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/javascript text/plain text/xml application/xml text/css application/x-javascript application/javascript
# 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
</IfModule>
# gzip end #

# compress text, HTML, JavaScript, CSS, and XML
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 text/javascript
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE font/woff .woff
AddOutputFilterByType DEFLATE application/x-font-woff
AddOutputFilterByType DEFLATE application/font-woff
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/x-font-otf

# 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
</IfModule>
# gzip end #

Attachments

Screenshot 2017-08-04 09.23.50.png

Screenshot 2017-08-04 09.23.50.png (560.97 KiB) Viewed 3624 times

Last edited by ideep13 on Mon Dec 31, 2018 4:41 am, edited 1 time in total.

User avatar
Active Member

Posts

Joined
Mon Jun 18, 2012 2:47 am

Post by ideep13 » Fri Aug 04, 2017 4:16 pm

the hosting provider (webhostingbuzz) are saying that they enabled mod rewrite.. but I would like to check for myself and access httpd.conf .. but I can not find it!

Is there any way to access this file? How fo I check if mod rewrite is on, because non of the code in .htaccess in working??


also I tried this code for home page, contact, account links.. ect. but it doesn't work:

Code: Select all

#NEW REWRITE RULES
ReWriteRule  ^home/$  index.php?route=common/home [L] #Home Page
RewriteRule  ^contact/?$  index.php?route=information/contact  [L] #Contact Page
ReWriteRule  ^account/?$  index.php?route=account/account  [L]  #Account Page
ReWriteRule  ^login/?$  index.php?route=account/login  [L]  #Login Page
ReWriteRule  ^logout/?$  index.php?route=account/logout  [L]  #Logout Link
ReWriteRule  ^cart/$  index.php?route=checkout/cart  [L] #Cart Page
ReWriteRule  ^checkout/$  index.php?route=checkout/checkout  [L] #Checkout Page
ReWriteRule  ^manufacturers/$  index.php?route=product/manufacturer  [L] #Manufacturer Page
ReWriteRule  ^specials/$  index.php?route=product/special  [L] #Specials Page
ReWriteRule  ^vouchers/$  index.php?route=account/voucher  [L] #Voucher Page
ReWriteRule  ^wishlist/$  index.php?route=account/wishlist  [L] #Wishlist Page
ReWriteRule  ^my-orders/$  index.php?route=account/orders  [L] #Past Orders Page
#END NEW REWRITE RULES

User avatar
Active Member

Posts

Joined
Mon Jun 18, 2012 2:47 am

Post by paulfeakins » Fri Aug 04, 2017 6:48 pm

There's some info here (not an OpenCart site):
https://www.antropy.co.uk/blog/case-stu ... rovements/

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


User avatar
Guru Member
Online

Posts

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

Post by ideep13 » Fri Aug 04, 2017 7:18 pm

the code that you gave me even worsen the results.. for 14%

- just the part in .htaccess

Attachments

Screenshot 2017-08-04 13.16.55.png

Screenshot 2017-08-04 13.16.55.png (657.53 KiB) Viewed 3594 times

Screenshot 2017-08-04 13.16.55.png

Screenshot 2017-08-04 13.16.55.png (657.53 KiB) Viewed 3594 times


User avatar
Active Member

Posts

Joined
Mon Jun 18, 2012 2:47 am

Post by IP_CAM » Sat Aug 05, 2017 1:38 am

Well, your .htaccess file is not configured well, by i.E. multiple times
activating rewrite on commands. But you could try this one, and if
it works as planned, you could still add some of your Custom Content,
also it's rewrite Content, but then ONLY after the SINGLE TO EXIST
RewriteEngine On Command Line.
Good Luck ;)
Ernie

PS: Your GTMETRIX Results look really bad, it's one of the worst, I've ever seen so far.
Anything below 94 Load / 88 JSON should not be accepted!

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 ideep13 » Sat Aug 05, 2017 2:37 am

Hi,

Thank you very much for your help. Unfortunately nothing changed.

This site doesn't have a lot of products so I don't understand why is this so bad..

I asked my hosting provider to check the httpd.conf file..

They said:
"
The Gzip is enabled on your website - https://checkgzipcompression.com/?url=http%3A%2F%2FXXXX

Expires headers are enabled in the httpd.conf.

Please, check your .htaccess in order to make sure that it's set up properly.<p>&nbsp;</p> "

Few days ago I migrated my other 1.5.1.3. OC site to this server and everything stopped working.. so I had to delete the other store, and I left only this one on this server..

The other site (1.5.1.3.) run better on Godaddy than the new OC with new hosting (Webhostingbuzz)

How can I enable compression for the following resources to reduce their transfer size by 63.5KiB (71% reduction)?

DELETED LINKS

I changed the php.ini file.. memory_limit to 256M and in cpanel not in multiphp ini editor..

Code: Select all

; cPanel-generated php ini directives, do not edit
; Manual editing of this file may result in unexpected behavior.
; To make changes to this file, use the cPanel MultiPHP INI Editor (Home >> Software >> MultiPHP INI Editor)
; For more information, read our documentation (https://go.cpanel.net/EA4ModifyINI)

allow_url_fopen = On
allow_url_include = Off
asp_tags = Off
display_errors = On
enable_dl = On
file_uploads = On
max_execution_time = 36000
max_input_time = 90
max_input_vars = 1000
memory_limit = 256M
session.gc_maxlifetime = 1440
session.save_path = "/tmp"
upload_max_filesize = 100M
this is from PHP selector
Current PHP version: 5.6
PHP Version
Set as current
Switch To PHP Extensions
allow_url_fopen On
display_errors Off
error_reporting E_ALL
file_uploads On
include_path .:/opt/alt/php56/usr/share/pear:/opt/alt/php56/usr/share/php
log_errors On
mail.force_extra_parameters no value
max_execution_time 30
max_input_time -1
memory_limit 256M
open_basedir no value
post_max_size 8M
session.save_path /tmp
short_open_tag On
upload_max_filesize 2M
Save
Home
Trademarks
Documentation

Attachments

Screenshot 2017-08-04 20.53.33.png

Screenshot 2017-08-04 20.53.33.png (410.8 KiB) Viewed 3556 times

Screenshot 2017-08-04 20.53.31.png

Screenshot 2017-08-04 20.53.31.png (413.24 KiB) Viewed 3556 times

Screenshot 2017-08-04 20.38.02.png

Screenshot 2017-08-04 20.38.02.png (652.46 KiB) Viewed 3559 times

Last edited by ideep13 on Mon Dec 31, 2018 4:43 am, edited 2 times in total.

User avatar
Active Member

Posts

Joined
Mon Jun 18, 2012 2:47 am

Post by MrPhil » Sat Aug 05, 2017 7:42 am

A few observations:

1. Just in case you weren't aware, the httpd.conf file is normally a system-wide version of the .htaccess file, that is not modifiable by individual accounts. You might not even be able to read it. Your changes to settings go in .htaccess. Possibly you will have your own httpd.conf file on your site. Ask your host which is the correct file. The format of URL rewrites and redirects may change slightly if you have to use httpd.conf.

If your changes to .htaccess seem to have no effect, ask your host to check that URL rewriting is allowed in .htaccess files. Sometimes hosts leave this capability disabled. Also make sure you are using .htaccess correctly -- that it's in the right directory (usually the public_html/ directory, or equivalent) and readable. I prefer to split .htaccess duties between site-wide items (leech control, IP ban, hotlink control, force http or https, force www) in /.htaccess, and store-specific items (such as SEO rewriting) in the store directory's .htaccess (e.g., /shop/.htaccess). This assumes you installed your store into its own directory (such as /shop/), which is a lot cleaner and easier to manage, but requires either a landing page in the root, or URL rewrite (silent) from / to /shop.

2. The following section is quite inefficient:

Code: Select all

RewriteCond %{HTTP_REFERER} !^http://djecje-kucice.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://djecje-kucice.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.djecje-kucice.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.djecje-kucice.com$      [NC]
RewriteCond %{HTTP_REFERER} !^https://djecje-kucice.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^https://djecje-kucice.com$      [NC]
RewriteCond %{HTTP_REFERER} !^https://www.djecje-kucice.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^https://www.djecje-kucice.com$      [NC]
RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]
and can be replaced with

Code: Select all

# hotlink protection. image file requests only allowed from this site
RewriteCond  %{HTTP_REFERER}  !^https?://(www\.)?djecje-kucice\.com(/)?.*$  [NC]
RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]
I can't promise that it will speed up your site by any noticeable amount, but it's worth a try.

3. I see a lot of php_value and php_flag commands in your .htaccess. Those which are actually needed should normally go in a php.ini file. Ask your host about it. Any up-to-date host permits a php.ini file (or equivalent), and many require it (forbid those commands in .htaccess). Note that the commands will change slightly when moved to php.ini. Make sure you know where the php.ini file needs to be (or already exists), and whether you need to add something to .htaccess to point to the php.ini file (e.g., an suPHP_ConfigPath command). The more commands you can take out of .htaccess, the faster it will run (although it still will take some time to run those in php.ini).

These changes may not speed you up very much, but every little bit helps.

User avatar
Active Member

Posts

Joined
Wed May 10, 2017 11:52 pm

Post by ideep13 » Sat Aug 05, 2017 6:29 pm

Dear MrPhil,

Thank you very much for your help.. I sent your advise to hosting service.. unfortunately this is the reply I get..
All PHP values can be managed from cPanel >> Select PHP. php.ini isn't allowed on our servers.

If you need to set any specific values, please let us know!<p>&nbsp;</p>

--------
They need specific advise what to do?? What kind of hosting provider needs advise on this? hey should know what to do..

Could someone please help them advise what to do??

On which hosting providers are you on?

edit: I forgot to tell you that .htaccess file is under public_html folder as well the admin and catalog folder.

User avatar
Active Member

Posts

Joined
Mon Jun 18, 2012 2:47 am

Post by ideep13 » Sat Aug 05, 2017 9:42 pm

omg..this is unbelievable..
Hello,

We're not able to restart Apache web server on our shared hosting. In order to get full root access, we recommend you to upgrade your account to VPS or Dedicated server.

Please, let us know if we can be of further assistance!<p>&nbsp;</p>

--------------------------------------------------------------------------------
On August 05, 2017 12:55 STASKKA - Vse za otroka wrote:

please restart /etc/init.d/httpd restart
Could please someone advise me on what to do??

User avatar
Active Member

Posts

Joined
Mon Jun 18, 2012 2:47 am

Post by MrPhil » Sat Aug 05, 2017 11:46 pm

They're saying that they won't restart a shared server (or its subsystems) for individual accounts. That's reasonable. Don't bother asking them to change shared configurations and restart shared facilities just for you. You need to know how to set your own configurations in your own .htaccess (or even httpd.conf) file, which doesn't need a server restart. Have you asked your host for information on how to set your own server configuration, in case you're going about it the wrong way?

You need to figure out for sure whether your .htaccess file(s) are being processed or are being ignored. Make an illegal change to /.htaccess and then try accessing your store... if it blows up with a 500 error, it's at least reading your .htaccess file. Whether anything it tries to set is actually used, is another question. If you are not allowed to use a php.ini file and have to use php_value and php_flag, you can set something for PHP that either causes an error, or you can see the change in phpinfo() output.

Code: Select all

<?php phpinfo(); ?>
Then see if you can actually do a URL rewrite that you can see, such as temporarily redirect to https or an invalid subdomain (with a 301 status) and see if your browser shows the new address.

It does sound like your host doesn't quite have its act together. If they can't communicate with you any better (and remember, communication is a two-way street), you might want to think about a new host. At any rate, not allowing a php.ini file sounds like the server may be quite back-level. Be ready to find another host if you keep having problems with them. However, the things you need to change for your site's server you should be able to do in .htaccess, and affect only your site.

User avatar
Active Member

Posts

Joined
Wed May 10, 2017 11:52 pm

Post by ideep13 » Sun Aug 06, 2017 1:05 am

xx
Last edited by ideep13 on Sun Aug 06, 2017 5:55 am, edited 1 time in total.

User avatar
Active Member

Posts

Joined
Mon Jun 18, 2012 2:47 am

Post by ideep13 » Sun Aug 06, 2017 3:35 am

I don't get it.. I know figured out that I have a ssl certificate.. I set it .. I hope correctly

I hava .htacces file under publc_html folder.. which is not root..

so I changed that in .htaccess file.. but now I get 404 error, not on the main page https://djecje-kucice.com , but on the category and products when you click on them.. modsecurity is disabled.. What should I do? after disabling SEO under system, page is again working.. I'm loosing my mind here.. please help

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 /djecjeku/public_html/

# compress text, HTML, JavaScript, CSS, and XML
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

## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 week"
ExpiresByType image/jpeg "access plus 1 week"
ExpiresByType image/gif "access plus 1 week"
ExpiresByType image/png "access plus 1 week"
ExpiresByType text/css "access plus 1 week"
ExpiresByType application/pdf "access plus 1 week"
ExpiresByType text/x-javascript "access plus 1 week"
ExpiresByType application/x-shockwave-flash "access plus 1 week"
ExpiresByType image/x-icon "access plus 1 week"
ExpiresDefault "access plus 1 week"
</IfModule>
## EXPIRES CACHING ##

# 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
RewriteRule sitemap.xml /index.php?route=feed/google_sitemap
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
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

User avatar
Active Member

Posts

Joined
Mon Jun 18, 2012 2:47 am

Post by IP_CAM » Sun Aug 06, 2017 3:47 am

RewriteBase /djecjeku/public_html/
CANNOT be your PATH, starting from the Shop ROOT SECTION!
if you have the Shop in your Site ROOT Main Directory, this Line looks like this:
RewriteBase /
---
Such a .htaccess File MUST ONLY exist in the Site SHOP ROOT, and if you
have .htaccess Files anywhere else, they usually only contain those two lines,
to prevent the Directory to be called directly from the OUTSIDE:
Order deny,allow
Deny from all


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 ideep13 » Sun Aug 06, 2017 5:40 am

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|(?<!robots)\.txt))">
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 /

#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 [L]
RewriteRule ^system/(.*) /index.php [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]

# compress text, HTML, JavaScript, CSS, and XML
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

## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 week"
ExpiresByType image/jpeg "access plus 1 week"
ExpiresByType image/gif "access plus 1 week"
ExpiresByType image/png "access plus 1 week"
ExpiresByType text/css "access plus 1 week"
ExpiresByType application/pdf "access plus 1 week"
ExpiresByType text/x-javascript "access plus 1 week"
ExpiresByType application/x-shockwave-flash "access plus 1 week"
ExpiresByType image/x-icon "access plus 1 week"
ExpiresDefault "access plus 1 week"
</IfModule>

<IfModule mod_security.c>
 SecFilterEngine On
 SecFilterScanPOST On
</IfModule>

## EXPIRES CACHING ##
# 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

### 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
this is the latest .htaccess - yours, but nothing changes

the only thing I noticed is when I hit https://djecje-kucice.com/Pokloni-za-bebe https works
but when you click on home category http://djecje-kucice.com/Igracke-za-vrt-i-dvoriste it goes to http://

the speed is the same..

PageSpeed Score
(57%)
YSlow Score
(46%)


when I disable SEO and SSL under system.. I get 403 error.. with the same .htaccess.. so I can't save the preference..

User avatar
Active Member

Posts

Joined
Mon Jun 18, 2012 2:47 am

Post by MrPhil » Sun Aug 06, 2017 5:49 am

ideep13 wrote:
Sun Aug 06, 2017 1:05 am
http://djecje-kucice.com/phpinfo.php
Uh, I didn't want you to make this publicly available. Please remove that file, otherwise a hacker may use the information shown to break into your system! What I wanted you to do was to look at the information that file provides, make a PHP setting change (such as max upload file size) in .htaccess (via php_value or php_flag) if you don't have php.ini, and see if the change shows up. That would show that the ability to change PHP settings is working.

If IP_CAM's fix to RewriteBase doesn't work, try commenting out (with # ) the 3 "BrowserMatch" lines that turn off gzip processing for certain browsers. Most of those browsers are ancient and very few people use them any more. Are you using such a browser, or where you're testing your site is using one? Anyway, that will tell you if you're turning off gzip too often. If it works after that, try enabling one at a time (remove # ).

User avatar
Active Member

Posts

Joined
Wed May 10, 2017 11:52 pm

Post by ideep13 » Sun Aug 06, 2017 5:54 am

with this .htaccess I can not change anything in system.. i get 404 error

I don't know what to do? Do I delete ssl folder?

User avatar
Active Member

Posts

Joined
Mon Jun 18, 2012 2:47 am

Post by ideep13 » Sun Aug 06, 2017 6:28 am

I removed the file.

RewriteBase / doesn't work
I tried removing # at everyline.. than each line seperately... the 3 line.. I can't change anything in system I get 404 error

I have php.ini_back file

Code: Select all

magic_quotes_gpc = Off;
register_globals = Off;
default_charset	= UTF-8;
memory_limit = 256M;
max_execution_time = 36000;
upload_max_filesize = 999M;
safe_mode = Off;
mysql.connect_timeout = 20;
session.auto_start = Off;
session.use_only_cookies = On;
session.use_cookies = On;
session.use_trans_sid = Off;
session.cookie_httponly = On;
session.gc_maxlifetime = 3600;
allow_url_fopen = on;
;display_errors = 1;
;error_reporting = E_ALL;
I even created php.ini and php5.ini file.. nothing works

can you please help me with direct instruction .. i can not now modify dashboard/system/option!
MrPhil wrote:
Sun Aug 06, 2017 5:49 am
ideep13 wrote:
Sun Aug 06, 2017 1:05 am
http://djecje-kucice.com/phpinfo.php
Uh, I didn't want you to make this publicly available. Please remove that file, otherwise a hacker may use the information shown to break into your system! What I wanted you to do was to look at the information that file provides, make a PHP setting change (such as max upload file size) in .htaccess (via php_value or php_flag) if you don't have php.ini, and see if the change shows up. That would show that the ability to change PHP settings is working.

If IP_CAM's fix to RewriteBase doesn't work, try commenting out (with # ) the 3 "BrowserMatch" lines that turn off gzip processing for certain browsers. Most of those browsers are ancient and very few people use them any more. Are you using such a browser, or where you're testing your site is using one? Anyway, that will tell you if you're turning off gzip too often. If it works after that, try enabling one at a time (remove # ).

User avatar
Active Member

Posts

Joined
Mon Jun 18, 2012 2:47 am

Post by ideep13 » Sun Aug 06, 2017 6:44 am

I think something is wrong with this part of teh code..

Code: Select all

RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteRule ^download/(.*) /index.php [L]
RewriteRule ^system/(.*) /index.php [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]
because If I delete this part I get 404 error code on each category..

if I leave it on, it works, but still system store editing doesn't work - I get 404 error.. and beside all of that I have a shitty speed

omg I don't know what to edit anymore .. at least I sort the https:// now it's showing whatever I type in-- https://djecje-kucice.com/

Code: Select all

RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule ^(.*) https://djecje-kucice.com%{REQUEST_URI} [R=301,L,NE]

User avatar
Active Member

Posts

Joined
Mon Jun 18, 2012 2:47 am

Post by MrPhil » Sun Aug 06, 2017 9:13 am

ideep13 wrote:
Sun Aug 06, 2017 6:44 am
I think something is wrong with this part of teh code..

because If I delete this part I get 404 error code on each category..
Why in the world did you try deleting it? It has nothing to do with your reported problem.

Code: Select all

RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteRule ^download/(.*) /index.php [L]
RewriteRule ^system/(.*) /index.php [L]
These 4 lines send /sitemap.xml, /googlebase.xml, /download/*, and /system/* requests to some specific places.

Code: Select all

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]
These 4 lines do something if the requested filename is not a real file and not a real directory, such as when you see some SEO addresses. If it's not a graphics file being requested, send it to the index.php with _route_ Query.

There is no point in randomly hacking at the file. You need to understand what it's doing, or at least to follow instructions when someone asks you to try changing something.

In another post you mentioned uncommenting 3 lines. Were these the 3 lines involving turning of gzip that I asked you to try commenting out, or 3 other lines?

User avatar
Active Member

Posts

Joined
Wed May 10, 2017 11:52 pm

Post by MrPhil » Sun Aug 06, 2017 9:33 am

ideep13 wrote:
Sun Aug 06, 2017 6:28 am
I removed the file.

What file? The entire /.htaccess file? Why?
RewriteBase / doesn't work
I don't think that was the problem, but what was there before probably should not have worked, anyway, so you should keep IP_CAM's fix for now.
I tried removing # at everyline.. than each line seperately... the 3 line.. I can't change anything in system I get 404 error
You weren't ask to remove # (uncomment) lines. You were asked to comment out (add # ) to the 3 lines involving gzip, and see if that helped anything. Then uncomment those 3 lines one at a time to see which specific one breaks the system.
I have php.ini_back file

Code: Select all

magic_quotes_gpc = Off;
register_globals = Off;
default_charset	= UTF-8;
memory_limit = 256M;
max_execution_time = 36000;
upload_max_filesize = 999M;
safe_mode = Off;
mysql.connect_timeout = 20;
session.auto_start = Off;
session.use_only_cookies = On;
session.use_cookies = On;
session.use_trans_sid = Off;
session.cookie_httponly = On;
session.gc_maxlifetime = 3600;
allow_url_fopen = on;
;display_errors = 1;
;error_reporting = E_ALL;
Where did this come from? Was it a working php.ini file, or something that came with OpenCart and never has been used?
I even created php.ini and php5.ini file.. nothing works
If your host told you to use .htaccess to set PHP configuration, try that first. You look in phpinfo to see some setting, such as max file upload size, and then change it in .htaccess (php_value command) and see if phpinfo shows it changed. If it does, you can use .htaccess with php_value and php_flag to change configuration. Be sure to change it back. If it doesn't work, ask your host how to use a php.ini or php5.ini file. You may have to add a command in .htaccess telling PHP where to find the php.ini file.
can you please help me with direct instruction .. i can not now modify dashboard/system/option!

What broke now? Restore your .htaccess to the last point it was more or less working, and we can figure out from there. I can try fixing this for you privately (directly), but you should be aware that I'm probably more expensive than you'd like to pay. Is there anyone at your location that could physically be there and look at the file, or is there no one around? I would prefer not having to deal with your hosting company myself (they don't sound terribly competent) and I would like for this to be out in public so that others may learn from it.
ideep13 wrote:
Sun Aug 06, 2017 1:05 am
http://djecje-kucice.com/phpinfo.php
Please remember to erase (or rename) this file. It should not be seen by others.

It's getting late in the evening, and I have to get up early in the morning for an appointment. I will probably not be able to check back in for as many as 18 hours from now. I hope that IP_CAM or someone else can help you in the meantime.

User avatar
Active Member

Posts

Joined
Wed May 10, 2017 11:52 pm
Who is online

Users browsing this forum: No registered users and 257 guests