Dear Opencart Users,
I LOVE OPENCART
Please let me know how to use .htaccess for my opencart store version 2.0.3.1, my store is installed in public_html.The present .htaccess contains nothing.Please provide me the all the necessary codes that are required for friendly SEO url and some more codes that are vital in .htaccess file with steps.It will be a very great help.
Thanks in Advance.
Please find the present .htaccess file in attachment.
I LOVE OPENCART
Please let me know how to use .htaccess for my opencart store version 2.0.3.1, my store is installed in public_html.The present .htaccess contains nothing.Please provide me the all the necessary codes that are required for friendly SEO url and some more codes that are vital in .htaccess file with steps.It will be a very great help.
Thanks in Advance.
Please find the present .htaccess file in attachment.
Here is the default .htaccess that will enable SEO URLs, plus some added goodies for compression, caching, etc.
Code: Select all
<FilesMatch "(?i)((\.tpl|\.ini|\.log|(?<!robots)\.txt))">
Order deny,allow
Deny from all
</FilesMatch>
RewriteEngine On
RewriteBase /
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=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) [NC]
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
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>
# 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
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
Order allow,deny
Allow from all
Thanks a ton,
Please tell where to place this .htaccess as I had two one outside the public_html and one inside the public_html I just edited the inside .htaccess file with 404 Error and deleted the outside .htaccess file (It had nothing) ,that worked and it showed the custom 404.html.But a major issue came up as I was changing over my admin/settings and clicked save button the following error occured.Please help SIR.
FORBIDDEN
You don't have permission to access /admin/index.php on this server.
Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request
Please tell where to place this .htaccess as I had two one outside the public_html and one inside the public_html I just edited the inside .htaccess file with 404 Error and deleted the outside .htaccess file (It had nothing) ,that worked and it showed the custom 404.html.But a major issue came up as I was changing over my admin/settings and clicked save button the following error occured.Please help SIR.
FORBIDDEN
You don't have permission to access /admin/index.php on this server.
Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request
That is not caused by the above .htaccess
You mentioned you had an .htaccess above the poublic_html folder.
Maybe that is the cause
You mentioned you had an .htaccess above the poublic_html folder.
Maybe that is the cause
and if you replace the one I put with just the following:
Code: Select all
RewriteEngine On
RewriteBase /
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=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) [NC]
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
Dear Sir,
Please find my present .htaccess file and the codes that you provided now I am getting error
Page cannot be found and it redirecting to my home page i.e to the index.php whenever I am trying to click USE SEO URL to yes and pressing save button in admin dashboard.Please help me get out of it.
PLEASE POINT OUT THE ERRORS IF ANY TELL ME WHAT IS THE REPLACEMENT.
Please find my present .htaccess file and the codes that you provided now I am getting error
Page cannot be found and it redirecting to my home page i.e to the index.php whenever I am trying to click USE SEO URL to yes and pressing save button in admin dashboard.Please help me get out of it.
PLEASE POINT OUT THE ERRORS IF ANY TELL ME WHAT IS THE REPLACEMENT.
Code: Select all
RewriteEngine on
RewriteCond ${LeechProtect:/home/mysitename/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_REFERER} !^http://mysitename.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://mysitename.com$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.mysitename.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.mysitename.com$ [NC]
RewriteCond %{HTTP_REFERER} !^https://mysitename.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^https://mysitename.com$ [NC]
RewriteCond %{HTTP_REFERER} !^https://www.mysitename.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^https://www.mysitename.com$ [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>
RewriteEngine On
RewriteBase /
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=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) [NC]
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
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>
# 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
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
Order allow,deny
Allow from all
So you chose not to put the default .htaccess as I posted and added a load of other htaccess rules.
Unfortunately, I can only lead a horse to water, I cannot make him drink it.
Unfortunately, I can only lead a horse to water, I cannot make him drink it.
Yes, just use the code I posted.
Remove all other code
Make a backup of your old file just in case you need it. It is however, not default OpenCart code that you had previously, so I am not sure of it's purpose or why it is needed, and is most likely causing issues.
Remove all other code
Make a backup of your old file just in case you need it. It is however, not default OpenCart code that you had previously, so I am not sure of it's purpose or why it is needed, and is most likely causing issues.
Sir,
I did exactly as you said but the problem is again there when pressing the save button on admin panel to use SEO URL it is redirecting to my home page before showing the below error.
Server Connection Closed
Description: The server requested closed the connection before the transaction was completed.
I did exactly as you said but the problem is again there when pressing the save button on admin panel to use SEO URL it is redirecting to my home page before showing the below error.
Server Connection Closed
Description: The server requested closed the connection before the transaction was completed.
Please also try a different web browser.
After checking your last error message, it seems it could be web browser related.
Also if you have a firewall on your computer, it could also be causing the issue.
After checking your last error message, it seems it could be web browser related.
Also if you have a firewall on your computer, it could also be causing the issue.
I have searched regarding this issue found the below information should I use these .
1.) # If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/
(All the files are inside public_html should I use the below code after RewriteBase /
RewriteBase / mysitename)
2.) Options +FollowSymlinks
# Prevent Directoy listing
Options -Indexes
(What are these codes for and how to use them and where in .htacces file?)
Like This #before +FollowSymlinks or any other syntax.
1.) # If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/
(All the files are inside public_html should I use the below code after RewriteBase /
RewriteBase / mysitename)
2.) Options +FollowSymlinks
# Prevent Directoy listing
Options -Indexes
(What are these codes for and how to use them and where in .htacces file?)
Like This #before +FollowSymlinks or any other syntax.
If your store is in the root of your domain then it should be
Rewritebase /
You can try either commenting out the Symlinks line (put # at beginning of line), or adding it if you don’t already have it
Rewritebase /
You can try either commenting out the Symlinks line (put # at beginning of line), or adding it if you don’t already have it
Who is online
Users browsing this forum: Semrush [Bot] and 6 guests