Skip to main content

htaccess causing admin layout error

Comments

8 comments

  • Karapuz

    Hello, Paul,

    It is unclear what changes you did to .htaccess. What would you like to achieve with these changes?

    Kind regards,

    Karapuz

    0
  • paul griffiths

    this is what i tried to  to htaccess, but then .admin staarted to mess up. I've not touched anything else.

    Header set Content-Security-Policy: upgrade-insecure-requests

    #<IfModule lsapi_module>
    # lsapi_phpini /home/laugowzz/public_html/php.ini
    #</IfModule>

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

    Options +FollowSymlinks

    # Prevent Directoy listing
    Options -Indexes

    # 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

    ## REWRITE DEFAULTS
    RewriteBase /

    ## SEO URL Settings
    RewriteEngine On

    ## Rewrite Rules
    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|webp|js|css|svg)
    RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
    RewriteRule ^(.*)$ https://laughingprofessor.com/$1 [R,L]
    RewriteCond %{HTTP_HOST} !^printingready.com$
    RewriteRule ^(.*)$ https://printingready.com/$1 [R=301,L]
    ## rewrite to www
    RewriteRule ^(.*)$ https://www.laughingprofessor.com/$1 [R=301,L]
    ## stop hotlinking
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^https://(www\.)?laughingprofessor\.com/.*$ [NC]
    RewriteRule \.(gif|jpg|swf|flv|png)$ https://www.laughingprofessor.com/feed.gif [R=302,L]

    RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
    RewriteRule ^sitemap.xml$ index.php?route=extension/feed/simple_google_sitemap [L]
    RewriteRule ^sitemap.xml$ index.php?route=extension/feed/google_sitemap [L]
    RewriteRule ^googlebase.xml$ index.php?route=extension/feed/google_base [L]
    RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
    RewriteRule ^download/(.*) /index.php?route=error/not_found [L]
    RewriteRule ^index\.php$ http://%{HTTP_HOST}? [R=301,L]

    RewriteCond %{REQUEST_URI} !^/\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$
    RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/(?:\ Ballot169)?
    RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
    RewriteCond %{REQUEST_URI} !.*\..*$
    rewriteCond %{REQUEST_URI} !^/admin/
    RewriteCond %{QUERY_STRING} ^route=common/home$
    RewriteCond %{REQUEST_METHOD} !^POST$
    RewriteCond %{SERVER_PORT} 80

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

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

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

    ## EXPIRES CACHING ##
    <IfModule mod_expires.c>
    ExpiresActive On
    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 text/html "access 1 month"
    ExpiresByType application/pdf "access 1 month"
    ExpiresByType text/x-javascript "access 1 month"
    ExpiresByType application/x-shockwave-flash "access 1 month"
    ExpiresByType image/x-icon "access 1 year"
    ExpiresDefault "access 1 month"
    </IfModule>

    <RequireAll>
    Require all granted
    Require not ip 185.214.167.82
    Require not ip 163.114.132.3
    Require not ip 46.236.10.84
    Require not ip 42.236.10.125
    Require not ip 185.103.110.206
    </RequireAll>
    deny from 80.79.116.136
    deny from 185.220.100.242
    deny from 185.103.110.209
    deny from 192.160.102.169
    deny from 188.120.245.234
    deny from 89.187.178.141
    deny from 188.124.242.148
    deny from 109.70.100.19
    <Files 403.shtml>
    order allow,deny
    allow from all
    </Files>

    <IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE application/javascript
    AddOutputFilterByType DEFLATE application/rss+xml
    AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
    AddOutputFilterByType DEFLATE application/x-font
    AddOutputFilterByType DEFLATE application/x-font-opentype
    AddOutputFilterByType DEFLATE application/x-font-otf
    AddOutputFilterByType DEFLATE application/x-font-truetype
    AddOutputFilterByType DEFLATE application/x-font-ttf
    AddOutputFilterByType DEFLATE application/x-javascript
    AddOutputFilterByType DEFLATE application/xhtml+xml
    AddOutputFilterByType DEFLATE application/xml
    AddOutputFilterByType DEFLATE font/opentype
    AddOutputFilterByType DEFLATE font/otf
    AddOutputFilterByType DEFLATE font/ttf
    AddOutputFilterByType DEFLATE image/svg+xml
    AddOutputFilterByType DEFLATE image/x-icon
    AddOutputFilterByType DEFLATE text/css
    AddOutputFilterByType DEFLATE text/javascript
    AddOutputFilterByType DEFLATE text/plain
    AddOutputFilterByType DEFLATE text/xml
    </IfModule>

    <IfModule mod_gzip.c>
    mod_gzip_on Yes
    mod_gzip_item_include file .html$
    mod_gzip_item_include file .php$
    mod_gzip_item_include file .css$
    mod_gzip_item_include file .js$
    mod_gzip_item_include mime ^application/javascript$
    mod_gzip_item_include mime ^application/x-javascript$
    mod_gzip_item_include mime ^text/.*
    mod_gzip_item_include handler ^application/x-httpd-php
    mod_gzip_item_exclude mime ^image/.*
    </IfModule>

    0
  • Karapuz

    Hello, Paul,

    There are a lot of changes to .htaccess. You should add them one by one to check what causes the issue. Most likely some resource file (css or js) is not loaded properly after these changes.

    Also, I noticed that there are multiple rewriteCond lines but they are not ended by RewriteRule. Usually rewriteCond directives are closed by RewriteRule because they are conditions for the specified rule.

    Kind regards,

    Karapuz

    0
  • paul griffiths

    Thanks that helps me. I admit i pasted 'rules' from google help which obviously was incomplete.
    now i just need to correct this coding, and to get my dashboard to display correctly.

    0
  • paul griffiths

    how and where do i check the css / js files are being called for and running correctly?

     

    0
  • Karapuz

    Hello, Paul,

    It is possible to open a developer console in browser and see if there are any errors regarding file loading.

    In chrome on windows it can be found here:

    https://i.imgur.com/CjR2ePp.png

    Later, open a page where you see any issues and check two tabs in the developer tools: 'Console', 'Network'. It might give you some clue on what is going on.

    https://i.imgur.com/fabUbmD.png

    Kind regards,

    Karapuz

    0
  • paul griffiths

    thanks very much @Karapuz for the info.

    0
  • muhammad Hussain

    Thank you for addressin this issue. I experienced the same problem on the http://englishinsane.com/  but after reaching out to the developer and making a few adjustments to the basic code, the issue was resolved.

    0

Please sign in to leave a comment.

Powered by Zendesk