2016-08-09 9 views
1

私には1つの質問があり、解決策を見つけることはできません。htacessサブフォルダにリダイレクトするとHTTPステータス301がリダイレクトされる

ウェブルートにサブフォルダを置いて、URLを変更せずにすべてのURLをこのサブフォルダにリダイレクトします。

例:domain.com/article123.html - > redirecting-> domain.com/subfolder/article123.htmlが、アドレスバーに私は私のルートに次のように入れ

をdomain.com/artcle123.comままhtaccessファイル:

RewriteEngine on 

RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com$ [NC] 
RewriteRule !^subfolder/ /subfolder%{REQUEST_URI} [L,NC] 

しかし、今、私はhttp://httpstatus.ioでURLをテストするとき、私はサブフォルダ内

301 → Error while fetching URL. 11 redirect 

を以下の取得私は別のhtaccessファイルを持っている:

RewriteCond %{REQUEST_METHOD} =GET 
RewriteCond %{QUERY_STRING} ^$ 
RewriteCond %{REQUEST_URI} "(.*)index.php" 
RewriteRule ^index\.php$ %1 [R=301,L] 


RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] 
RewriteRule ^(.*)$ http://%1/$1 [R=301,L] 

RewriteCond %{REQUEST_FILENAME} ^(.*)\.(php|css|js|gif|jpg|jpeg|png)$ [NC] 
RewriteRule ^(.+) - [L] 

RewriteCond %{REQUEST_URI} (.*)?/admin/(.*) 
RewriteRule ^(.+) - [L] 

RewriteCond %{REQUEST_URI} (.*)?/images/(.*) 
RewriteRule ^(.+) - [L] 

RewriteCond %{REQUEST_URI} (.*)?/templates/(.*) 
RewriteRule ^(.+) - [L] 

RewriteCond %{REQUEST_FILENAME} -d 
RewriteRule ^(.+) - [L] 

RewriteCond %{REQUEST_FILENAME} -f 
RewriteRule ^(.+) - [L] 

RewriteCond %{REQUEST_FILENAME} -l 
RewriteRule ^(.+) - [L] 

##boosted CONTENT 
RewriteRule (^[a-z]{2})/(.*/)?info/([A-Za-z0-9_-]+)\.html.* shop_content.php?language=$1&gm_boosted_content=$3&%{QUERY_STRING} [PT,L] 
RewriteRule (.*/)?info/([A-Za-z0-9_-]+)\.html.* shop_content.php?gm_boosted_content=$2&%{QUERY_STRING} [PT,L] 

##boosted PRODUCTS 
RewriteRule (^[a-z]{2})/(.*/)?([A-Za-z0-9_-]+)\.html product_info.php?language=$1&gm_boosted_product=$3&%{QUERY_STRING} [PT,L] 
RewriteRule (.*/)?([A-Za-z0-9_-]+)\.html product_info.php?gm_boosted_product=$2&%{QUERY_STRING} [PT,L] 

##boosted CATEGORIES 
RewriteRule (^[a-z]{2})/(.*/)?([A-Za-z0-9_-]+)/?.* index.php?language=$1&gm_boosted_category=$3&%{QUERY_STRING} [L] 
RewriteRule (.*/)?([A-Za-z0-9_-]+)/?.* index.php?gm_boosted_category=$2&%{QUERY_STRING} [L] 

私はその理由を知りません。誰も助けることができますか?

+0

URLがlegal-dreams.bizで、GXサブフォルダにリダイレクトされています...このサブフォルダに、私は製品のURLを書き換え、別のhtaccessファイルを持っています、カテゴリなど –

+0

thルートURLは問題を引き起こすのではなく、すべての記事URLたとえば –

答えて

0

ルートの.htaccessがsubfolder/.htaccessでこれをしようと、正常に見える:

RewriteEngine On 

RewriteCond %{REQUEST_METHOD} =GET 
RewriteCond %{THE_REQUEST} /index\.php 
RewriteCond %{REQUEST_URI} (.*)index\.php 
RewriteRule ^index\.php$ %1 [R=301,L,NE] 

RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] 
RewriteRule^http://%1%{REQUEST_URI} [R=301,L,NE] 

RewriteCond %{REQUEST_FILENAME} ^(.*)\.(php|css|js|gif|jpg|jpeg|png)$ [NC,OR] 
RewriteCond %{REQUEST_URI} /(admin|images|templates)/ 
RewriteCond %{REQUEST_FILENAME} -d [OR] 
RewriteCond %{REQUEST_FILENAME} -f 
RewriteRule^- [L] 

##boosted CONTENT 
RewriteRule (^[a-z]{2})/(.*/)?info/([\w-]+)\.html shop_content.php?language=$1&gm_boosted_content=$3 [QSA,L,NC] 

RewriteRule (.*/)?info/([\w-]+)\.html shop_content.php?gm_boosted_content=$2 [QSA,L,NC] 

##boosted PRODUCTS 
RewriteRule (^[a-z]{2})/(.*/)?([\w-]+)\.html product_info.php?language=$1&gm_boosted_product=$3 [QSA,L,NC] 

RewriteRule (.*/)?([\w-]+)\.html product_info.php?gm_boosted_product=$2 [QSA,NC,L] 

##boosted CATEGORIES 
RewriteRule (^[a-z]{2})/(.*/)?([A-Za-z0-9_-]+)/? index.php?language=$1&gm_boosted_category=$3 [L,QSA,NC] 

RewriteRule (.*/)?([\w-]+)/? index.php?gm_boosted_category=$2 [L,QSA,NC] 
+0

お返事ありがとうございます!うーん、残念ながら同じ結果です...私はこのURLで試しました:http://legal-dreams.biz/de/Raeuchermischung-Kush-2-5g.html httpstatus.ioで、結果は同じです:-( –

+0

サブディレクトリの名前は "GX3" –

+0

このURLを開いても、http:// legal-dreams.biz/Raeuchermischung-Kush-2-5g.htmlには、301のURLがhttp://legal-dreams.bizにリダイレクトされています/ de/Raeuchermischung-Kush-2-5g.html'私の答えには、前に 'de /'を追加するルールはありません。あなたのコードの中で起きていると思われます。 – anubhava

関連する問題