我有以下結構的網站:403錯誤上安裝WordPress的子目錄
/public_html
/main site content (html content mostly)
/.htaccess (1)
/secret (dir)
/wp (dir)
/a wordpress install
/.htaccess (2)
/祕密/ WP /,就是要開發站點移動到WordPress的解決方案。這是我在新網站上工作的地方。
當我嘗試查看新網站時,根.htaccess導致403禁止的錯誤。我知道這是因爲從服務器上刪除它可以解決問題。
問題是,它爲我做了一些重要的文件擴展名重寫,我需要或者我的主站點中斷。
htaccess的(1)
<Files ~ "^\.(htaccess|htpasswd)$">
deny from all
</Files>
DirectoryIndex index.html
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(wp-admin)($|/) - [L] # You don't want to mess with WordPress
RewriteRule ^/secret/wp/ - [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule .* $0.html
# browser requests html
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^\ ]+)\.html
RewriteRule ^/?(.*)\.html$ /$1 [L,R=301]
# check to see if the request is for a html file:
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^/?(.*)$ /$1.html [L]
</IfModule>
Redirect 301 /shop.html https://mydomain.myshopify.com/
添加行 「重寫規則^ /祕密/ WP/- [L]」 是尋找一個解決這個問題的結果,但它似乎沒有做任何事情。
我的其他.htaccess似乎根本沒有觸發。我將發佈它爲清楚:
的.htaccess(2)
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /secret/wp/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /secret/wp/index.php [L]
# Fix 403 errors on existing directories; WordPress overrides.
RewriteCond %{REQUEST_URI} ^/secret/wp/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
我在適合做什麼損失。我不能只刪除.htaccess文件,否則整個網站都會中斷,但我似乎無法弄清楚如何阻止403錯誤。我很確定這是因爲重寫規則,但它似乎並沒有停止像它應該的目錄。
任何幫助將不勝感激。
你能解釋一下它應該去的地方嗎?或者它將試圖完成什麼?我嘗試了幾個地方,但它不會改變我嘗試訪問mydomain.com/secret/wp/ –
時得到的403錯誤,它將搜索子目錄wp-content,wp-admin和wp-includes 。 –
請確保你的服務器上有mod_rewrite –