Mem Faction
Mem Faction

Reputation: 5

Exclude folder in .htaccess

Whenever I try to access newly created folder /shop/ which has ecommerce 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, but none worked. Could you please help me out? I would like to completely exclude rules for /shop/ folder and use ecommerce ones.

The following .htaccess file is placed in root public_html folder and is the cause of this problem:

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.xmarket.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]

Upvotes: 1

Views: 231

Answers (1)

Not sure what you have tried ... and what not but adding the fallowing rewrite condition and rule should do the trick:

RewriteCond %{REQUEST_URI}  !^/shop
RewriteRule ^.*$ index.php [NC,L]

there is a similar example on this thred: htaccess - do not rewrite in this case

And also a little educational info on this one: https://webmasters.stackexchange.com/questions/9513/htaccess-execution-order-and-priority

As it is stated in the las post you can learn a lot about .htaccess files from the Apache Tutorial: .htaccess

Upvotes: 1

Related Questions