1

每当我尝试访问其中包含电子商务的新创建的文件夹 /shop/ 时,我都会收到 403 Forbidden 错误。如果我直接输入 /shop/index.php 就可以了,但这对访问者来说不是一个可行的选择。我已经尝试了几种我设法找到的解决方案,但没有一个奏效。你能帮帮我吗?我想完全排除 /shop/ 文件夹的规则并使用电子商务规则。

以下 .htaccess 文件位于根 public_html 文件夹中,是导致此问题的原因:

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]
4

1 回答 1

1

不知道你尝试了什么......除了添加休闲的重写条件和规则之外应该做些什么:

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

在这个线程上有一个类似的例子:htaccess - 在这种情况下不要重写

还有一些关于这个的教育信息:https ://webmasters.stackexchange.com/questions/9513/htaccess-execution-order-and-priority

正如 las 帖子中所述,您可以从 Apache 教程中了解很多关于 .htaccess 文件的信息:.htaccess

于 2013-10-18T22:32:15.383 回答