Opencart 2.0 Unable to login - Admin login loop - opencart2.x

I am using Opencart 2.1.0.1 on my website.
Everything was working fine, but now when I try to login to admin it wont show the dashboard but return to the admin screen - a login loop.
Kindly take a look and help me out if you can.. thanks a lot.
I'm trying to solve this for the past 3 days looking at the forums etc but nothing seem to work. There is no SSL. I dont have any Opencart extensions installed, the PHP version is 5.4.45.
Admin login was working fine before.
my .htaccess file
Options +FollowSymlinks
Options -Indexes
RewriteEngine On
RewriteBase /
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteRule ^system/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]
RewriteCond %{HTTP_HOST} !^www\.example\.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
I can list the config files if needed..
Any help appreciated.. thanks a lot.

Related

htaccess RewriteRule _route_=$1 https

I have inherited support for an Opencart 1.5 site which needs to have SSL enabled.
I've edited the config.php files in / and admin/ and adding https:// to the URL is working in the browser and links are being generated with https
However, whatever method of an htaccess redirect I try seems to result in the site not loading.
The following is in the htaccess file and I suspect the problem is related to the last line here with route which I've not seen before.
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]
Any suggestions on how I can add https to this RewriteRule?
Thanks

htaccess redirect not working properly

I am trying to accomplish the following but my code is not working
1) I want to do either non-www to www or www to non-www
2) desktop users should be redirected to example.com/homepage
3) remove or hide /homepage from url
4) redirect mobile users to example.com/m
here is my code, it's not working, too many problems to list, but off the top of my head, I can think of 2 problems that I encountered: "cannot open page because too many redirects occurred" and mobile users are taken to /homepage instead of /m
# remove www
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ http://%1%{REQUEST_URI} [NE,R=301,L]
RewriteEngine On
RewriteRule ^$ /homepage [L]
RewriteEngine On
RewriteRule ^$ homepage/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ homepage/$1
RewriteCond %{HTTP_USER_AGENT} ^.*(ip(ad|od|hone)|blackberry|iemobile|android).*$ [NC]
RewriteCond %{REQUEST_URI} !^/m/.*
RewriteRule ^.*$ http://example.com/m [R=301,L]
Please help me, I am so frustrated, what am I supposed to change about this code to get it to work?
Unfortunately im no genious with regex or redirects in htacces but I have gotten similar code to work myself.
It does sound like your code is getting stuck in a redirect loop and the browser is stopping it from continuing.
I know thats not a complete answer but Hopefully that helps you make more sense of the code atleast a little.
Hopefully someone else can chime in otherwise i can dig up the code that is working when im on the computer and hopefully give you a better response.
-Sent from my cell
The www/non-www is fine.
For the homepage stuff, you need to do two things: make sure what you're rewriting into the homepage directory actually exists (otherwise you get a 500 server error) and exclude mobile user agents.
So this stuff:
RewriteEngine On
RewriteRule ^$ /homepage [L]
RewriteEngine On
RewriteRule ^$ homepage/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ homepage/$1
Needs to look like this:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{HTTP_USER_AGENT} !^.*(ip(ad|od|hone)|blackberry|iemobile|android).*$ [NC]
RewriteCond %{DOCUMENT_ROOT}/homepage%{REQUEST_URI} -f [OR]
RewriteCond %{DOCUMENT_ROOT}/homepage%{REQUEST_URI} -d [OR]
RewriteRule ^(.*)$ homepage/$1 [L]

How can I redirect pages with parameters to pages on an different domain

I searched the forum and found some questions close to what I am trying to achieve but they don't work for what I am trying to do.
We got a new client and we need to redirect the pages of his old website to the new one.
All the pages in the old website have this structure:
http://www.domain.com/index.php?option=com_content&view=article&id=158&Itemid=179
I need to redirect each page to the relevant page of the new website. The structure of the urls in the new website is like this:
http://newdomain.website.com/slug/
I am assuming that the only way to do this is through htaccess but I cannot figure out how to write the command.
Thank u in advance for any help.
try this :
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) http://newdomain.website.com/slug/$1 [L,QSA]
Put this code in your DOCUMENT_ROOT/.htaccess file on domain.com:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^option=.+ [NC]
RewriteRule ^index\.php$ http://newdomain.website.com/slug/? [L,NC,R=301]
EDIT:
RewriteCond %{QUERY_STRING} ^option=.+?&Itemid=.*?64$ [NC]
RewriteRule ^(index\.php)?$ http://newdomain.website.com/slug/? [L,NC,R=302]
RewriteCond %{THE_REQUEST} /index\.php [NC]
RewriteCond %{QUERY_STRING} ^option=.+?&Itemid=.*?64$ [NC]
RewriteRule ^ http://newdomain.website.com/slug/? [L,NC,R=302]

Code igniter url rewrite on EC2

I have a set of Codeigniter website hosted on
http://ec2-23-22-24-128.compute-1.amazonaws.com/
However, when it fails when I try to access via the sub-domain:
http://ec2-23-22-24-128.compute-1.amazonaws.com/dashboard
http://ec2-23-22-24-128.compute-1.amazonaws.com/index.php/dashboard
I have set the htaccess and set AllowOverride All.
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\?*$ index.php/$1 [L,QSA]
Could anyone advice?
If you go to the Codeigniter guide:
http://ellislab.com/codeigniter%20/user-guide/general/urls.html
It clearly shows you that you can use this for mod_rewrite:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

Htaccess URL masking to specific folder

I have the following problem.
I need when people access to www.mydomain.com they really access to www.mydomain.com/folder, and they keep seeing www.mydomain.com in the URL.
How can this be done with de .htaccess of my server?
Thanks
create a .htaccess file in the root of the site with the following code:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?mydomain.com/$ [NC]
RewriteCond %{REQUEST_URI} !^../folder
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-zA-Z0-9/-_.\s]+)?$ ../folder/$1 [L]
RewriteCond %{HTTP_HOST} ^(www.)?mydomain.com$ [NC]
RewriteRule ^(/)?([a-zA-Z0-9/-_.\s]+)$ ../folder/$2 [L]
that's all you need.
RewriteEngine On
RewriteRule ^(.*)$ /folder/$1 [L]
and try to search before you ask something! there are lots of examples like that.

Resources