[英]Redirect Prestashop 1.5 from subfolder to the root
我在子文件夹而不是根目录中安装了Prestashop1.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友好 ,因此在子文件夹中安装时可以搜索存储。 还是将商店从子文件夹移动到根目录更好?
改写是不同形式的重定向 。
.htaccess方法比JavaScript重定向更好。 您为客户节省了无用的请求。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.