简体   繁体   中英

opencart domain .htaccess issue

I have a domain with open cart installed and I also have SSL on my site. If anyone hits our site through http://www.example .com/pageseo

they're automatically redirected to

https://www.example .com/index.php? route =pageseo

How can we possibly get rid of this index.php? route = Please advise?

Here is my .htaccess code.

RewriteCond %{HTTPS} off
# First rewrite to HTTPS:
# Don't put www. here. If it is already there it will be included, if not
# the subsequent rule will catch it.
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Now, rewrite any request to the wrong domain to use www.
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

You need go to catalog system/library , in file response.php find line with public function output() and after it insert:

if (!defined('HTTP_CATALOG')) $this->output = str_replace('index.php?route=common/home', '', $this->output);

Additionaly add in your .htaccess file next:

RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]

You could try this, haven't tested it with Opencart but it works elsewhere.

RewriteCond %{HTTP_HOST} ^example\.com$ [OR]
RewriteCond %{HTTPS} !on
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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