每当我尝试访问新创建的文件夹/商店/其中有电子商务时,我都会收到403 Forbidden错误。如果我直接输入/shop/index.php,它可以工作,但这对访问者来说不是一个可行的选择。 我已经尝试了几个我设法找到的解决方案,但都没有用。你能帮帮我吗?我想完全排除/ shop / folder的规则并使用电子商务。
以下.htaccess文件放在root 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]
答案 0 :(得分:1)
不确定你曾经尝试过什么......但是什么不是,但添加了重写条件和规则应该可以解决问题:
RewriteCond %{REQUEST_URI} !^/shop
RewriteRule ^.*$ index.php [NC,L]
这个问题有一个类似的例子:htaccess - do not rewrite in this case
还有一点关于这一点的教育信息:https://webmasters.stackexchange.com/questions/9513/htaccess-execution-order-and-priority
正如在las帖子中所述,您可以从Apache Tutorial: .htaccess
了解很多关于.htaccess文件的内容。