memfaction

Member
Oct 18, 2013
10
0
1
cPanel Access Level
Website Owner
Whenever I try to access newly created folder /shop/ which has newly installed Opencart in it, I get 403 Forbidden error. It works if I enter /shop/index.php directly, but that's not a viable option for visitors. I've already tried several solutions I've managed to found for modifying .htaccess, but none worked. Could you please help me out? I would like to completely exclude rules for /shop/ folder and use Opencart default ones.

The following .htaccess file is placed in root public_html folder. If I rename it, /shop/ will actually open up just as it should but in all the other folders, I get "Website is currently unavailable. Please try again later" HTML message instead of desired content. cPanel Version on server is 11.34.2 (build 4).

Code:
Options -Indexes
Options +FollowSymLinks
Options -MultiViews
RewriteEngine On
RewriteBase /
RewriteRule ^teksti/([^./]+)([/]?)$ teksti.php?niceid=$1 [T=application/x-httpd-php,L]
RewriteRule ^clanki/([^./]+)([/]?)$ clankistran.php?niceid=$1 [T=application/x-httpd-php,L]
RewriteCond %{HTTP_HOST} .*www.domain.com
RewriteRule ^$ sportna_prehrana.php [T=application/x-httpd-php,L]

RewriteRule ^stran.php$ sportna_prehrana.php%{QUERY_STRING} [T=application/x-httpd-php,L,R=301]
RewriteRule ^cart.php$ nakup.php%{QUERY_STRING} [T=application/x-httpd-php,L,R=301]

RewriteRule ^xfit/$ xfit/xfit.php
RewriteRule ^forum/$ forum/index.php

#Redirect permanent page_wellness.php xfit/

#RewriteRule ^internet.html$ internet.php?%{QUERY_STRING} [T=application/x-httpd-php,L]
#RewriteRule ^programska_oprema.html$ programska_oprema.php?%{QUERY_STRING} [T=application/x-httpd-php,L]
#RewriteRule ^storitve.html$ teksti.php?act=storitve&%{QUERY_STRING} [T=application/x-httpd-php,L]
#RewriteRule ^podjetje.html$ teksti.php?act=opodjetju&%{QUERY_STRING} [T=application/x-httpd-php,L]
#RewriteRule ^pogoji.html$ teksti.php?act=pogoji&%{QUERY_STRING} [T=application/x-httpd-php,L]
#RewriteRule ^privatnost.html$ teksti.php?act=privatnost&%{QUERY_STRING} [T=application/x-httpd-php,L]
#RewriteRule ^stran.html$ stran.php?aktualno=1&%{QUERY_STRING} [T=application/x-httpd-php,L]
#RewriteRule ^podjetje/([^./]+).html$ stran.php?nicepod=$1&%{QUERY_STRING} [T=application/x-httpd-php,L]
#RewriteRule ^([^./]+).html$ stran.php?nicecat0=$1&%{QUERY_STRING} [T=application/x-httpd-php,L]
#RewriteRule ^([^./]+)/a/([^./]+).html$ stran.php?nicecat0=$1&niceart=$2&%{QUERY_STRING} [T=application/x-httpd-php,L]
#RewriteRule ^([^./]+)/([^./]+).html$ stran.php?nicecat0=$1&nicecat1=$2&%{QUERY_STRING} [T=application/x-httpd-php,L]
#RewriteRule ^([^./]+)/([^./]+)/a/([^./]+).html$ stran.php?nicecat0=$1&nicecat1=$2&niceart=$3&%{QUERY_STRING} [T=application/x-httpd-php,L]
#RewriteRule ^([^./]+)/([^./]+)/([^./]+).html$ stran.php?nicecat0=$1&nicecat1=$2&nicecat2=$3&%{QUERY_STRING} [T=application/x-httpd-php,L]
#RewriteRule ^([^./]+)/([^./]+)/([^./]+)/a/([^./]+).html$ stran.php?nicecat0=$1&nicecat1=$2&nicecat2=$3&niceart=$4&%{QUERY_STRING} [T=application/x-httpd-php,L]
ErrorDocument 404 /404.php
#DirectoryIndex page_wellness.php
#DirectoryIndex sportna_prehrana.phpRewriteCond %{HTTP_HOST} ^xy.com$ [OR]
DirectoryIndex vstop.php

RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^page_wellness.php$ "http\:\/\/www\.xy\.com\/xfit\/" [R=301,L]

RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^page_wellness.php/$ "http\:\/\/www\.xy\.com\/xfit\/" [R=301,L]

RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^xfit/urednik/$ "http\:\/\/www\.xy\.com\/xfit\/urednik\/index\.php" [R=301,L]

RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^xfit/podstrani/$ "http\:\/\/www\.xy\.com\/xfit\/podstrani\/index\.php" [R=301,L]

RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^kontakti/$ "http\:\/\/www\.xy\.com\/kontakti\/index\.php" [R=301,L]

RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^sportno_drustvo\.php$ "http\:\/\/www\.xy\.com\/sdx\/" [R=301,L]
 

24x7server

Well-Known Member
Apr 17, 2013
1,912
99
78
India
cPanel Access Level
Root Administrator
Twitter
Hello,

Can you please try to add following code in your .htaccess file and check it

Code:
DirectoryIndex index.php index.html site-down.php
Also try to check your error_log file
 
  • Like
Reactions: mghafari23

memfaction

Member
Oct 18, 2013
10
0
1
cPanel Access Level
Website Owner
Thanks, your solution did the trick. At first I put that line into root .htaccess but I got error "Website is currently unavailable. Please try again later" whenever I tried to visit root folder (I found out that this is actually index.php file in root folder).

But when I put this line into /shop/ .htaccess file, all of pages opened up just as they should.

Now there is just one problem left. I've created subdomain and pointed it into /public_html/shop, but when I open it, Default cPanel Web Site Page opens up from "/cgi-sys/defaultwebpage.cgi". Any ideas how to make it work?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,261
463
Now there is just one problem left. I've created subdomain and pointed it into /public_html/shop, but when I open it, Default cPanel Web Site Page opens up from "/cgi-sys/defaultwebpage.cgi". Any ideas how to make it work?
Hello :)

Make sure the domain name uses the name servers provided by your web hosting provider. If it uses different name servers, make sure it's pointing to the correct IP address. You can also try clearing the browser and DNS cache on your machine to see if the issue continues.

Thank you.
 

memfaction

Member
Oct 18, 2013
10
0
1
cPanel Access Level
Website Owner
Hello,

Thanks, I will contact my hosting provider to solve this problem out.

Oh, and regarding to my first problem, perhaps I was too quick when I said it's solved out. As soon as I enable SEO optimized links in Opencart settings, the problem returns. Let me give you an example: SEO will make URLs of products look like this http://domain.com/shop/product-name . Since there are no file extensions (like product.php), your trick doesn't work it this case.

I also found out where message "Website is currently unavailable. Please try again later" comes from when I try to open URL like the one described before. It's actually only index.php file in public_html root folder with that simple text in it, nothing else. But I have no idea how to disable this aggresive redirection. Perhaps you may know?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,261
463
You may want to check with OpenCart to see why the default Mod_Rewrite rules are failing to properly function. There may be settings or configuration values that they can recommend to you. It may also be a good idea to consult with your web hosting provider to see if there are any server settings in-place that could be preventing the rules from working as intended.

Thank you.