0

ルートではなく、サブフォルダーに Prestashop 1.5.x をインストールしました。ルート ディレクトリからアクセスできるようにしたいので、.htaccess ファイルを編集して RewriteCond と RewriteRule を設定し、メイン ドメインとサブフォルダーを変更しました。それは機能し、メイン ドメインからストアに即座にリダイレクトします。

# Copy and paste the following code into the .htaccess file
# in the public_html folder of your hosting account
# make the changes to the file according to the instructions.

# Do not change this line - RewriteEngine on
RewriteEngine on

# Change yourdomain.com to be your main domain.
RewriteCond %{HTTP_HOST} ^(www.)?mysite.com$

# Change 'subfolder' to be the folder you will use for your main domain.
RewriteCond %{REQUEST_URI} !^/prestashop/

# Don't change this line.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# Change 'subfolder' to be the folder you will use for your main domain.
RewriteRule ^(.*)$ /prestashop/$1

# Change yourdomain.com to be your main domain again.
# Change 'subfolder' to be the folder you will use for your main domain
# followed by / then the main file for your site, index.php, index.html, etc.
RewriteCond %{HTTP_HOST} ^(www.)?mysite.com$
RewriteRule ^(/)?$ prestashop/index.php [L]

私の質問:これは正しい方法ですか、それとも次のようなjavascriptでindex.htmlを使用してリダイレクトする方が良いですか?

<head>
<script type="text/javascript"><!--
location.replace("http://maindomain.com/shop/index.php")
//-->
</script>
  <title></title>
</head>

私の懸念は、Prestashop ページをSEO フレンドリーにする方法についてです。そのため、ストアをサブフォルダーにインストールすると検索可能になります。または、ストアをサブフォルダーからルートに移動することをお勧めしますか?

4

1 に答える 1

1

書き換えはリダイレクトとは異なります。

.htaccessの方法は、javascript リダイレクトよりも優れています。クライアントを無駄な要求から救います。

于 2013-05-14T13:06:35.000 に答える