Apache 不工作的seo url从旧的http到https的产品名称和规范url仍然在http而不是https上
我在Opencart中将seo友好的URL从旧的http应用到新的https时遇到了问题 以前我们有很好的seo url,比如domain.com/productname,但上个月我们为我们的网站购买了ssl证书,现在所有的url都是https版本,所以这些产品页面的格式已经改变了,例如,如果你点击链接,它现在会像opencart中的一样凌乱 我只想删除index.php?route=url参数,以便所有链接都成为domain.com/productname。我还尝试了GWT获取,以查看它不是重定向URL。我还检查了标题状态为200 规范URL仍在http而不是https,一些产品链接仍指向http,而不是https 到目前为止,我对page没有任何问题,比如关于我们的问题。联系我们,他们工作得很好 以下是我的.htaccess:Apache 不工作的seo url从旧的http到https的产品名称和规范url仍然在http而不是https上,apache,.htaccess,mod-rewrite,redirect,seo,Apache,.htaccess,Mod Rewrite,Redirect,Seo,我在Opencart中将seo友好的URL从旧的http应用到新的https时遇到了问题 以前我们有很好的seo url,比如domain.com/productname,但上个月我们为我们的网站购买了ssl证书,现在所有的url都是https版本,所以这些产品页面的格式已经改变了,例如,如果你点击链接,它现在会像opencart中的一样凌乱 我只想删除index.php?route=url参数,以便所有链接都成为domain.com/productname。我还尝试了GWT获取,以查看它不是重
RewriteEngine On
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]
#This setting force logo url to it's home page
RewriteCond %{QUERY_STRING} ^route=common/home$
RewriteRule ^index\.php$ https://www.domain.com/? [R=301,L]
#This setting force http to https version
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.domain.com/$1 [R=301,L]
您需要在路由规则之前保留重定向规则:
RewriteEngine On
RewriteBase /
#This setting force logo url to it's home page
RewriteCond %{QUERY_STRING} ^route=common/home$
RewriteRule ^index\.php$ https://www.domain.com/? [R=301,L,NE,NC]
#This setting force http to https version
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.domain.com/$1 [R=301,L,NE]
#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]
另外,请确保在新浏览器中对此进行测试,以避免旧的浏览器缓存。另一个解决方案是使网站配置的ssl部分也允许覆盖 cd/etc/apache2/可用站点 nano yourdomain.com.conf 添加以下代码
<Directory "/var/www/html/yourdomain.com/public_html">
AllowOverride All
Require all granted
</Directory>
允许超越所有
要求所有授权
里面
<VirtualHost *:443>
.....
</VirtualHost>
.....
是的,它可以正常工作,但是有些URL看起来很不寻常,比如有些URL指向https,有些URL位于http中。规范url仍在http而不是https中。你以前遇到过这种问题吗?我检查了标题状态和返回的200,也在谷歌网站管理员上做了检查。我的网站的https和http版本可能存在一些重复问题。强制http到https
规则应该强制https
到每个URL。所以最终他们会在一个月左右后从http转到https?我想我会等待谷歌在https版本中索引和缓存这些页面,对吗?是的,没错,最终旧的缓存页面将被新的页面取代。