Php 将Prestashop 1.5从子文件夹重定向到根目录

Php 将Prestashop 1.5从子文件夹重定向到根目录,php,apache,seo,prestashop,Php,Apache,Seo,Prestashop,我在子文件夹中安装了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 change

我在子文件夹中安装了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]
我的问题:这是正确的方法,还是更好地使用index.html和javascript重定向,如下所示:

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


我关心的是如何使Prestashop页面对SEO友好,以便在安装到子文件夹中时可以搜索存储。或者最好将存储从子文件夹移动到根目录?

重写与重定向不同


.htaccess方式比javascript重定向更好。您为客户端保存了一个无用的请求。

使用.htaccess文件进行重写是否有利于SEO?与将存储移动到根目录相比。如果将存储移动到根文件夹,URL将更短。根据SEO实践,这样做更好,因为这会增加url中关键字的密度:
http://mysite.tld/blue-suede-shoes
http://mysite.tld/prestashop/blue-suede-shoes