I discovered that if customers go to example.com instead of www.example.com, the add to cart button don't work (1.5.05 version) on the front page.
Does the following code look ok? I added to two last lines.
I' just not sure if it's ok to use two RewriteRules.
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
Does the following code look ok? I added to two last lines.
I' just not sure if it's ok to use two RewriteRules.
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
Anbefalt vibrator
Dildo i glass og metall
Myke sex leketøy i silikon
This is how I have mine:
Code: Select all
RewriteCond %{HTTP_HOST} ^z22se.co.uk
RewriteRule (.*) http://www.z22se.co.uk/$1 [R=301,L]
I have been old before that this could be down to a jquery thing where it is only set to www.example.com with the prefix.
I advice you do what MattW has done as this fixed my issue with jquery and missing WWW. prefix
I advice you do what MattW has done as this fixed my issue with jquery and missing WWW. prefix
Regards
Chris
I have tried MattW's method, but then I couldn't log into my admin panel.
I get the log in screen, but nothing happens when I try to log in.
Anything I need to change in config.php in my admin map?
Edit: solved
just had to add some www. in the config.php (admin map).
I get the log in screen, but nothing happens when I try to log in.
Anything I need to change in config.php in my admin map?
Edit: solved
just had to add some www. in the config.php (admin map).
Anbefalt vibrator
Dildo i glass og metall
Myke sex leketøy i silikon
Here is the code I use - Hope it helps
Code: Select all
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
My OpenCart is installed in a '/shop' directory and I'm having a problem using this code below:
RewriteBase /shop
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
Problems I'm seeing:
1.) When I type my domain without WWW, it doesn't redirect to my domain with WWW.
2.) When I type my domain without WWW, but also include the '/shop' directory to access the OCart, it redirects back to http://www.mydomain.com without the '/shop' directory.
Thanks for the help.
*******EDITED*********
I just figured out solution for #2 above:
When I change RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] to RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/shop$1 [R=301,L] (adding the /shop) it correctly redirects when typing the /shop directory.
Still can't figure out how to solve #1 though. Help on that appreciated.
RewriteBase /shop
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
Problems I'm seeing:
1.) When I type my domain without WWW, it doesn't redirect to my domain with WWW.
2.) When I type my domain without WWW, but also include the '/shop' directory to access the OCart, it redirects back to http://www.mydomain.com without the '/shop' directory.
Thanks for the help.
*******EDITED*********
I just figured out solution for #2 above:
When I change RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] to RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/shop$1 [R=301,L] (adding the /shop) it correctly redirects when typing the /shop directory.
Still can't figure out how to solve #1 though. Help on that appreciated.
That's because RewriteBase should have a trailing slash
i.e.
RewriteBase /shop/
not
RewriteBase /shop
i.e.
RewriteBase /shop/
not
RewriteBase /shop
Thanks for your reply. I changed /shop to /shop in my htaccess file and that didn't solve my problem. The redirect works perfectly when i access my site with the /shop directory or any directories within the /shop directory. But if I go to my domain without the /shop directory and without typing www, it does not redirect correctly. Any other suggestions?
Here is the Rewrite section that I would use
RewriteEngine On
RewriteBase /shop/
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
RewriteEngine On
RewriteBase /shop/
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
Hi Simon,
I have tried using the code you printed above to redirect from non-www to www, whilst still retaining SEO friendly URLS, but it is not working as expected and not transferring from non-www to www. Is there anything else that needs configuring? My config files say http://domainname.co.uk... as opposed to http://www.domainname.co.uk, but changing this resulted in a 'page not found error' Any ideas?
I have tried using the code you printed above to redirect from non-www to www, whilst still retaining SEO friendly URLS, but it is not working as expected and not transferring from non-www to www. Is there anything else that needs configuring? My config files say http://domainname.co.uk... as opposed to http://www.domainname.co.uk, but changing this resulted in a 'page not found error' Any ideas?
Hi,
Well your config file should read as follows:
the trailing slash is important
Well your config file should read as follows:
Code: Select all
http://www.yourdomain.com/shop/
Hi Simon,
My config files currently read using the format:
define('HTTP_SERVER', 'http://domain.co.uk/');
If i change that to:
define('HTTP_SERVER', 'http://www.domain.co.uk/');
i get a 'page not found error' when viewing the site
does the prefix www. need to be set anywhere else?
My config files currently read using the format:
define('HTTP_SERVER', 'http://domain.co.uk/');
If i change that to:
define('HTTP_SERVER', 'http://www.domain.co.uk/');
i get a 'page not found error' when viewing the site
does the prefix www. need to be set anywhere else?
Its actually not a 'page not found error' but a 'oops! This link appears to be broken' error. Typing the URL http://domain.co.uk/designers works fine, but the URL http://www.domain.co.uk/designers gives the 'Oops! This link appears to be broken' error - makes me think that somewhere i am specifying a non-www URL but no idea where???
Hi Simon,
Made a bit more progress now - appologise, i was missing a line in the .htaccess file. All redirects are working fine now and the SEO friendly URLs. Using the code you pasted though (copied my version below), i am not able to login to administration though which is obviously causing me some problems !?
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
Many thanks for your help
Emily
Made a bit more progress now - appologise, i was missing a line in the .htaccess file. All redirects are working fine now and the SEO friendly URLs. Using the code you pasted though (copied my version below), i am not able to login to administration though which is obviously causing me some problems !?
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
Many thanks for your help
Emily
Would you believe me if i now said it was all working correctly !?! Able to login no problems, maybe something was cached....thanks for your help
When you install opencart you have to choose between www or non-www url.
Probably you chose non-www so now you must choose the same in .htaccess
Here the solution http://forum.opencart.com/viewtopic.php?f=20&t=29515
Probably you chose non-www so now you must choose the same in .htaccess
Here the solution http://forum.opencart.com/viewtopic.php?f=20&t=29515
Sigaretta elettronica Opencart 1.5.4.1 italian translation
While this seems to work well to help the code redirect, how do you avoid getting subdomains to redirect as with the rest of the site. For example if you have the subdomain 'test' at http://test.domain.com, how do you avoid it from becoming http://www.test.domain.com, which for obvious reasons will not work.
Nevermind, I just figured this out. It seems all you have to do is create a condition that places the sub-domain in a no case rule to stop it from being part of the decision, as below, based on your subdomain of course.
RewriteCond %{HTTP_HOST} !^subdomain\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
Ya, glad we figured that out. Now you can see our redirects at http://newtress.com. It should go to http://www.newtress.com.
RewriteCond %{HTTP_HOST} !^subdomain\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
Ya, glad we figured that out. Now you can see our redirects at http://newtress.com. It should go to http://www.newtress.com.
Who is online
Users browsing this forum: No registered users and 77 guests