繁体   English   中英

.htaccess 301 http://重定向到https://没有被Google编入索引

[英].htaccess 301 http:// redirect to https:// not being indexed by Google

我们最近将2个网站移至完整的SSL,因为我们知道Google在安全网站方面的排名更高。 但它已经超过两个月了,我们的网站没有被编入SSL索引。

例如;

在将ssl放入我们Joomla网站的一周内,我们所有的网址都在Google中更改为https://这就是我们想要的 - 这是因为我们在Joomla htaccess中设置了301重定向。

但是在我们的Opencart网站上有一个不同配置的htaccess文件,它仍然只在Google上显示非SSL结果。 SSL在我们的网站上正常运行,并且已经被Google抓取了数十次,但出于某种原因,Google不会将我们编入索引作为https网站。

我想我们的htaccess中没有设置正确的301重定向。 我在下面附上:

#gzip starts
<ifModule mod_deflate.c>
<filesMatch "\.(js|css|txt|woff)$">
SetOutputFilter DEFLATE
</filesMatch>
</ifModule>

#cache starts
<FilesMatch "\.(ico|jpg|jpeg|png|gif|js|css|swf|woff|txt)$">
<IfModule mod_expires.c>
ExpiresActive on

ExpiresDefault "access plus 14 days"
</IfModule>
Header unset ETag
FileETag None
</FilesMatch>

#domain rewrite starts
RewriteCond %{HTTP_HOST} !^(www\.|$) [NC]
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://www.gomobility.ie/$1 [R=301,L]


# 1.To use URL Alias you need to be running apache with mod_rewrite enabled. 

# 2. In your opencart directory rename htaccess.txt to .htaccess.

# For any support issues please visit: http://www.opencart.com

Options +FollowSymlinks

# Prevent Directoy listing 
Options -Indexes

# Prevent Direct Access to files
<FilesMatch "\.(tpl|ini|log)">
 Order deny,allow
 Deny from all
</FilesMatch>

# SEO URL Settings
RewriteEngine On
# If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/ 

RewriteBase /
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteRule ^download/(.*) /index.php?route=error/not_found [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]

### Additional Settings that may need to be enabled for some servers 
### Uncomment the commands by removing the # sign in front of it.
### If you get an "Internal Server Error 500" after enabling any of the following settings, restore the # as this means your host doesn't allow that.

# 1. If your cart only allows you to add one item at a time, it is possible register_globals is on. This may work to disable it:
# php_flag register_globals off

# 2. If your cart has magic quotes enabled, This may work to disable it:
# php_flag magic_quotes_gpc Off

# 3. Set max upload file size. Most hosts will limit this and not allow it to be overridden but you can try
# php_value upload_max_filesize 999M

# 4. set max post size. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value post_max_size 999M

# 5. set max time script can take. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value max_execution_time 200

# 6. set max time for input to be recieved. Uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value max_input_time 200

# 7. disable open_basedir limitations
# php_admin_value open_basedir none

真的很感激任何帮助。

您的规范链接仍然不是ssl。 OpenCart生成规范链接(查看您的来源)。 这些链接是通过OpenCart生成的,不会受到htaccess的影响。

有几种方法可以改变这种状况。 首先,您可以找到调用链接函数的每个实例,并添加SSL作为第三个参数。

替换这个:

$this->url->link('example/path');

有了这个:

$this->url->link('example/path', '', 'SSL');

或者您可以更改链接功能以默认将所有链接作为SSL链接处理。 转到system / library / url.php并更改此行。

public function link($route, $args = '', $connection = 'NONSSL') {

对此:

public function link($route, $args = '', $connection = 'SSL') {

您的规范标签是http版本,我会将其更改为https以避免发送冲突的信号。

只有两点,你当然可以知道。 首先,确保您的站点地图索引https而不是http。 其次,您必须使用新的https网站地址在Google网站管理员中设置新网站 - 请勿删除旧网站。 然后,您将看到正在编制索引的新网站。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM