0

opencart を 2 つのフォルダーにインストールしました。1 つはルート フォルダー、つまり「public_html/」で、もう 1 つは「public_html/test/」です。どちらの opencart にも .htaccess ファイルが含まれています。

「public_html/」フォルダーにある opencart の .htaccess ファイルには、次の書き換えルールが含まれています。

RewriteBase /
RewriteRule sitemap.xml /new/index.php?route=feed/google_sitemap
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
RewriteCond %{HTTP_HOST} ^abcd\.co\.in
RewriteRule (.*) http://www.abcd.co.in/$1 [R=301,L]

「public_html/test/」フォルダーにある opencart の .htaccess ファイルには、次の書き換えルールが含まれています。

RewriteBase /test/
RewriteRule sitemap.xml /new/index.php?route=feed/google_sitemap
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]

問題は、 Domain http://abcd.co.inを開くとhttp://www.abcd.co.inにリダイレクトされますが、http://abcd.co.in/testを開くと

リダイレクトしていません

私にhttp://www.abcd.co.in/test

4

2 に答える 2

1

URLを叩いたら

http://abcd.co.in/test/

フォルダーに別のファイルがある場合、ルートフォルダーの.htaccessファイルpublic_htmlはカウントされません。このように拡張する必要があります:.htaccesspublic_html/test/public_html/test/.htaccess

RewriteBase /test/
RewriteRule sitemap.xml /new/index.php?route=feed/google_sitemap
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
RewriteCond %{HTTP_HOST} ^abcd\.co\.in/test/
RewriteRule (.*) http://www.abcd.co.in/test/$1 [R=301,L]

これでうまくいくはずです。

于 2013-01-17T11:48:02.877 に答える
0

Your redirection rule is not applied. Also .htaccess should be limited to the folder your associated it too, try this, top of my head:

RewriteBase /test/
RewriteRule sitemap.xml /test/index.php?route=feed/google_sitemap
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^?]*) /test/index.php?_route_=$1 [L,QSA]
于 2013-01-17T09:12:54.383 に答える