2016-09-23 3 views
0

ウェブサイトの構造は次のとおりです:.htaccess in subfolder work部分的に

www.mydomain.com - >ここにはwordpressがインストールされています。
www.mydomain.com/subfolder1 - >ここにカスタムPHPアプリケーションがインストールされています。 www.mydomain.com/subfolder1/subfolder2 - >ここにはPHPアプリケーションのコントロールパネルがインストールされています。

サブフォルダ1には.htaccessがあり、サブフォルダ2には.htaccessがあり、サブフォルダ1のナビゲーションは素晴らしいですが、サブフォルダ2のナビゲーションは間違っています。

私はwww.mydomain.com/subfolder1/subfolder2/index.phpを見ることができますが、www.mydomain.com/subfolder1/subfolder2/test URLの変更をメニューでナビゲートしたいのですが、いつもインデックスを参照しています。 PHP

アドバイスはありますか? subfolder1で

の.htaccessはsubfolder2で

Option -Indexes 
ErroDocument 404/404.php 
RewriteEngine On 
RewriteBase /subfolder1/ 

#Remove extra trailing slashes 
RewriteCond %{REQUEST_URI} ^(.*)/{2,}(.*)$ 
RewriteRule . %1/%2 [R=301,L] 

#Add missing trailing slash 
RewriteCond %{REQUEST_URI} /+[^\.]+$ 
RewriteRule ^(.+[^/])$ %{REQUEST_URI}/ [R=301,L] 

RewriteRule /(uploads/.*) $1 [R=301,L] 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-l 
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L] 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php?$1 [L,QSA] 

RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s(.*)/index\.php [NC] 
RewriteRule^%1 [R=301,L] 

<ifModule mod_deflate.c> 
<filesmatch "\.(js|css|html|jpg|png|gif|eot|woff|ttf|svg)$"> 
    SetOutputFilter DEFLATE 
</filesmatch> 
</ifModule> 

<FilesMatch "\.(htaccess|htpasswd|ini|log|sh|inc|bak|cache|tpl)$"> 
    Order Allow,Deny 
    Deny from all 
</FilesMatch> 

の.htaccessは似てsubfolder1ですが、私は「あなたがでRewriteBaseを変更しているので、あなたが配置する必要はありませんでRewriteBase

Option -Indexes 
ErroDocument 404/404.php 
RewriteEngine On 
RewriteBase /subfolder1/subfolder2/ 

#Remove extra trailing slashes 
RewriteCond %{REQUEST_URI} ^(.*)/{2,}(.*)$ 
RewriteRule . %1/%2 [R=301,L] 

#Add missing trailing slash 
RewriteCond %{REQUEST_URI} /+[^\.]+$ 
RewriteRule ^(.+[^/])$ %{REQUEST_URI}/ [R=301,L] 

RewriteRule /(uploads/.*) $1 [R=301,L] 

RewriteCond %{REQUEST_URI} ^/subfolder2(.+)$ 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-l 

RewriteRule ^(.+)$ subfolder2/index.php?url=$1 [QSA,L] 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-l 
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L] 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php?$1 [L,QSA] 

RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s(.*)/index\.php [NC] 
RewriteRule^%1 [R=301,L] 

<ifModule mod_deflate.c> 
<filesmatch "\.(js|css|html|jpg|png|gif|eot|woff|ttf|svg)$"> 
    SetOutputFilter DEFLATE 
</filesmatch> 
</ifModule> 

<FilesMatch "\.(htaccess|htpasswd|ini|log|sh|inc|bak|cache|tpl)$"> 
    Order Allow,Deny 
    Deny from all 
</FilesMatch> 

答えて

0

を変更しましたRewriteConditionとRewriteRuleに「subfolder2」を追加します。

これを保持し、最初の.htaccessとしてRewriteBaseを変更してください

関連する問題