No access to admin after htaccess change [SOLVED]
18 posts
• Page 1 of 1
No access to admin after htaccess change [SOLVED]
Hello
My site currently has duplicate pages as /index.php is also present as another version of the home page etc. Also, the site is accessible without www.
So, to rectify the above I added the below code to the htaccess.txt file:
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.mydomain\.co\.uk
RewriteRule (.*) http://www.mydomain.co.uk/$1 [R=301,L]
Options +FollowSymLinks
RewriteCond %{THE_REQUEST} ^.*/index\.php
RewriteRule ^(.*)index.php$ http://www.mydomain.co.uk/$1 [R=301,L]
In order to then make this work, I had to change 'htaccess.txt' to just 'htaccess' however as soon as I did this two errors occurred:
1. I can no longer access my admin area
2. add to cart stops working on the website (you click it and nothing happens).
This problem has also occurred when I try to activate SEO URL's in the admin area, in order to do that I also have to change htaccess.
Any advice very much appreciated.
Cheers
My site currently has duplicate pages as /index.php is also present as another version of the home page etc. Also, the site is accessible without www.
So, to rectify the above I added the below code to the htaccess.txt file:
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.mydomain\.co\.uk
RewriteRule (.*) http://www.mydomain.co.uk/$1 [R=301,L]
Options +FollowSymLinks
RewriteCond %{THE_REQUEST} ^.*/index\.php
RewriteRule ^(.*)index.php$ http://www.mydomain.co.uk/$1 [R=301,L]
In order to then make this work, I had to change 'htaccess.txt' to just 'htaccess' however as soon as I did this two errors occurred:
1. I can no longer access my admin area
2. add to cart stops working on the website (you click it and nothing happens).
This problem has also occurred when I try to activate SEO URL's in the admin area, in order to do that I also have to change htaccess.
Any advice very much appreciated.
Cheers
Last edited by Superior1 on Mon Dec 19, 2011 2:09 pm, edited 1 time in total.
- Superior1
- Posts: 29
- Joined: Sat Aug 27, 2011 9:39 am
Re: No access to admin after htaccess change
There should be a logical order to the .htaccess, you cannot just put rules and symlinks anywhere
replace your htaccess content with the following:
replace your htaccess content with the following:
- Code: Select all
# 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 /
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteRule sitemap.xml /index.php?route=feed/google_sitemap
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
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
Happy Coding!
Simon
------
Commercial Mods:
Google Merchant / Base XML Feed + Bing Shopping + Sitemaps - Automatic Friendly SEO URLs
Full List of UKSB Extensions and Mods
vQmod Generator - Develop & Test OpenCart on your Local Windows machine
Click here if I have helped you and you would like to make a donation
Simon
------
Commercial Mods:
Google Merchant / Base XML Feed + Bing Shopping + Sitemaps - Automatic Friendly SEO URLs
Full List of UKSB Extensions and Mods
vQmod Generator - Develop & Test OpenCart on your Local Windows machine
Click here if I have helped you and you would like to make a donation
-

uksitebuilder - Posts: 5602
- Joined: Thu Jun 09, 2011 3:37 pm
- Location: United Kindgom
Re: No access to admin after htaccess change
Hi UKSB
Thanks for the help, much appreciated. I just did as you suggested but the same problem occurred plus the front end stopped working if I didn't include the www. I'm pretty sure I'm doing something wrong! I copied your code exactly, and then I tried messing with the below element:
I put my domain in various places to try and get this working. I'm quite a novice in coding so apologies in advance if I'm missing something that should be obvious.
If it's of any use, I also have a shared SSL set up so not sure if this is having any negative effect.
Many thanks
Chris
Thanks for the help, much appreciated. I just did as you suggested but the same problem occurred plus the front end stopped working if I didn't include the www. I'm pretty sure I'm doing something wrong! I copied your code exactly, and then I tried messing with the below element:
uksitebuilder wrote:RewriteBase /
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteRule sitemap.xml /index.php?route=feed/google_sitemap
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
[/code]
I put my domain in various places to try and get this working. I'm quite a novice in coding so apologies in advance if I'm missing something that should be obvious.
If it's of any use, I also have a shared SSL set up so not sure if this is having any negative effect.
Many thanks
Chris
- Superior1
- Posts: 29
- Joined: Sat Aug 27, 2011 9:39 am
Re: No access to admin after htaccess change
Shared SSl doesn't work with OpenCart out of the box.
In your config.php and admin/config.php you should have your main domain (not the SSL) set in the HTTP defines
Your SSL should only be set in the HTTPS defines.
However as mentioned above, shared SSL simply doesn't work with OC by default without an extension
In your config.php and admin/config.php you should have your main domain (not the SSL) set in the HTTP defines
Your SSL should only be set in the HTTPS defines.
However as mentioned above, shared SSL simply doesn't work with OC by default without an extension
Happy Coding!
Simon
------
Commercial Mods:
Google Merchant / Base XML Feed + Bing Shopping + Sitemaps - Automatic Friendly SEO URLs
Full List of UKSB Extensions and Mods
vQmod Generator - Develop & Test OpenCart on your Local Windows machine
Click here if I have helped you and you would like to make a donation
Simon
------
Commercial Mods:
Google Merchant / Base XML Feed + Bing Shopping + Sitemaps - Automatic Friendly SEO URLs
Full List of UKSB Extensions and Mods
vQmod Generator - Develop & Test OpenCart on your Local Windows machine
Click here if I have helped you and you would like to make a donation
-

uksitebuilder - Posts: 5602
- Joined: Thu Jun 09, 2011 3:37 pm
- Location: United Kindgom
Re: No access to admin after htaccess change
Hi there
Yes, I bought the extension from yourselves (UKSB-Shared-SSL-Support-v-1.0.0).
As that extension is installed, is there any other potential cause of the issue?
Many thanks for your help.
Chris
Yes, I bought the extension from yourselves (UKSB-Shared-SSL-Support-v-1.0.0).
As that extension is installed, is there any other potential cause of the issue?
Many thanks for your help.
Chris
- Superior1
- Posts: 29
- Joined: Sat Aug 27, 2011 9:39 am
Re: No access to admin after htaccess change
Is there a link I can view
Happy Coding!
Simon
------
Commercial Mods:
Google Merchant / Base XML Feed + Bing Shopping + Sitemaps - Automatic Friendly SEO URLs
Full List of UKSB Extensions and Mods
vQmod Generator - Develop & Test OpenCart on your Local Windows machine
Click here if I have helped you and you would like to make a donation
Simon
------
Commercial Mods:
Google Merchant / Base XML Feed + Bing Shopping + Sitemaps - Automatic Friendly SEO URLs
Full List of UKSB Extensions and Mods
vQmod Generator - Develop & Test OpenCart on your Local Windows machine
Click here if I have helped you and you would like to make a donation
-

uksitebuilder - Posts: 5602
- Joined: Thu Jun 09, 2011 3:37 pm
- Location: United Kindgom
Re: No access to admin after htaccess change
comment our the RewriteBase / line
like so
# RewriteBase /
like so
# RewriteBase /
Happy Coding!
Simon
------
Commercial Mods:
Google Merchant / Base XML Feed + Bing Shopping + Sitemaps - Automatic Friendly SEO URLs
Full List of UKSB Extensions and Mods
vQmod Generator - Develop & Test OpenCart on your Local Windows machine
Click here if I have helped you and you would like to make a donation
Simon
------
Commercial Mods:
Google Merchant / Base XML Feed + Bing Shopping + Sitemaps - Automatic Friendly SEO URLs
Full List of UKSB Extensions and Mods
vQmod Generator - Develop & Test OpenCart on your Local Windows machine
Click here if I have helped you and you would like to make a donation
-

uksitebuilder - Posts: 5602
- Joined: Thu Jun 09, 2011 3:37 pm
- Location: United Kindgom
Re: No access to admin after htaccess change
uksitebuilder wrote:comment our the RewriteBase / line
like so
# RewriteBase /
Hi Simon
Ok have done this, now what's happening is if I enter mydomain.co.uk it redirects to http://www.mydomain.co.uk which is great.
However three issues remain:
1. /index.php doesn't redirect to http://www.mydomain.co.uk
2. Same as point 2 when I click checkout on the site
I've changed the htaccess back to .txt for now.
Hope you can help? Not sure what link I could send that may help so let me know?
Many thanks
Chris
Last edited by Superior1 on Thu Jan 19, 2012 10:28 pm, edited 1 time in total.
- Superior1
- Posts: 29
- Joined: Sat Aug 27, 2011 9:39 am
Re: No access to admin after htaccess change
Something else has happened now, unsure if related but I haven't altered anything else:
The add to cart button in category has started to go to a product not found page, instead of adding straight to the basket as it did previously. For example:
http://www.mydomain.co.uk/index.php?rou ... path=17_85
I have put the old content back into htaccess and changed it back to .txt so I can't see how this has been affected - although I did have this problem briefly after I set up the shared SSL as per the readme file with the download (seemed to rectify itself though??
Sorry, feel like I'm being a pain in the ass..
Many thanks
The add to cart button in category has started to go to a product not found page, instead of adding straight to the basket as it did previously. For example:
http://www.mydomain.co.uk/index.php?rou ... path=17_85
I have put the old content back into htaccess and changed it back to .txt so I can't see how this has been affected - although I did have this problem briefly after I set up the shared SSL as per the readme file with the download (seemed to rectify itself though??
Sorry, feel like I'm being a pain in the ass..
Many thanks
Last edited by Superior1 on Thu Jan 19, 2012 10:29 pm, edited 1 time in total.
- Superior1
- Posts: 29
- Joined: Sat Aug 27, 2011 9:39 am
Re: No access to admin after htaccess change
something appear to be swapping your & signs to & in the URL which is why you are getting product not found.
I see you are on 1.5.0 - Is that 1.5.0.5 ? If not, I would seriously suggest upgrading to 1.5.0.5 at the least to remove any bugs.
I seem to remember a bug fix related to ampersands in URLS which may resolve your issue.
back to the htaccess problem.
We need to put a condition in the htaccess for the SSL because that is not on www. so we need to tell it not to rewrite to www. for SSL addresses.
The index.php and index.php?route=common/home both need to be redirected to just the domain name.
Please see amended htaccess code below which should hopfully fill all of that.
I see you are on 1.5.0 - Is that 1.5.0.5 ? If not, I would seriously suggest upgrading to 1.5.0.5 at the least to remove any bugs.
I seem to remember a bug fix related to ampersands in URLS which may resolve your issue.
back to the htaccess problem.
We need to put a condition in the htaccess for the SSL because that is not on www. so we need to tell it not to rewrite to www. for SSL addresses.
The index.php and index.php?route=common/home both need to be redirected to just the domain name.
Please see amended htaccess code below which should hopfully fill all of that.
- Code: Select all
# 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 /
RewriteCond %{HTTP_HOST} ^superiorbedlinen\.co\.uk
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{QUERY_STRING} ^route=common/home$
RewriteRule .? http://www.%{HTTP_HOST}/? [L,R=301]
RewriteCond %{THE_REQUEST} ^.*/index.php
RewriteRule ^(.*)index.php$ http://www.%{HTTP_HOST}/? [L,R=301]
RewriteRule sitemap.xml /index.php?route=feed/google_sitemap
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
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
Happy Coding!
Simon
------
Commercial Mods:
Google Merchant / Base XML Feed + Bing Shopping + Sitemaps - Automatic Friendly SEO URLs
Full List of UKSB Extensions and Mods
vQmod Generator - Develop & Test OpenCart on your Local Windows machine
Click here if I have helped you and you would like to make a donation
Simon
------
Commercial Mods:
Google Merchant / Base XML Feed + Bing Shopping + Sitemaps - Automatic Friendly SEO URLs
Full List of UKSB Extensions and Mods
vQmod Generator - Develop & Test OpenCart on your Local Windows machine
Click here if I have helped you and you would like to make a donation
-

uksitebuilder - Posts: 5602
- Joined: Thu Jun 09, 2011 3:37 pm
- Location: United Kindgom
Re: No access to admin after htaccess change
Hi Simon
Thanks for this, I will sort the upgrade, one question on that as I haven't upgraded before - I've edited a fair bit for example losing things like refine search, reward points etc. When I upgrade will these all reappear and have to be edited again?
And back to this htaccess issue, thank you for the new content. I put this in place and the SSL matter resolves. However it was taking me to the home page whatever I clicked and also made the domain http://www.www.superior..... So two lots of www?
I messed with this element a bit and have stopped that happening as follows:
#RewriteBase /
RewriteCond %{HTTP_HOST} ^mydomain\.co\.uk
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{QUERY_STRING} ^route=common/home$
RewriteRule sitemap.xml /index.php?route=feed/google_sitemap
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
This makes the none www version redirect to www but index.php is still present as a duplicate.
Again, any advice very much appreciated....
Thanks
Chris
Thanks for this, I will sort the upgrade, one question on that as I haven't upgraded before - I've edited a fair bit for example losing things like refine search, reward points etc. When I upgrade will these all reappear and have to be edited again?
And back to this htaccess issue, thank you for the new content. I put this in place and the SSL matter resolves. However it was taking me to the home page whatever I clicked and also made the domain http://www.www.superior..... So two lots of www?
I messed with this element a bit and have stopped that happening as follows:
#RewriteBase /
RewriteCond %{HTTP_HOST} ^mydomain\.co\.uk
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{QUERY_STRING} ^route=common/home$
RewriteRule sitemap.xml /index.php?route=feed/google_sitemap
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
This makes the none www version redirect to www but index.php is still present as a duplicate.
Again, any advice very much appreciated....
Thanks
Chris
Last edited by Superior1 on Thu Jan 19, 2012 10:30 pm, edited 1 time in total.
- Superior1
- Posts: 29
- Joined: Sat Aug 27, 2011 9:39 am
Re: No access to admin after htaccess change
Sorted it, as follows:
#RewriteBase /
RewriteCond %{HTTP_HOST} ^mydomain\.co\.uk
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteRule ^index\.php$ http://www.mydomain.co.uk/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
Thanks for all your help. I still have 'Add to Cart' error but will have to upgrade.
Cheers
Chris
#RewriteBase /
RewriteCond %{HTTP_HOST} ^mydomain\.co\.uk
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteRule ^index\.php$ http://www.mydomain.co.uk/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
Thanks for all your help. I still have 'Add to Cart' error but will have to upgrade.
Cheers
Chris
Last edited by Superior1 on Thu Jan 19, 2012 10:30 pm, edited 1 time in total.
- Superior1
- Posts: 29
- Joined: Sat Aug 27, 2011 9:39 am
Re: No access to admin after htaccess change [SOLVED]
I'm having a problem with customer and admin login only on Firefox. Admin and customer login work just fine on IE and Chrome. On firefox I'm getting 400 bad request because it's trying to redirect the login url to .www.www and firefox does not understand it.
The login process is being done, it just doesn't take the user to the intended page, the page gets stuck. This problem is happening to me with SEO enabled/disabled, with .htaccess or without .htaccess, it doesn't matter.
As for admin login I'm using Chrome to manage the store, the problem is for customer login, many people use firefox and they will have problems.
If anyone knows a solution for this problem, please help. Thanks!
I'm using the latest firefox version and opencart 1.5.1.3
http://www.chimarrao.com/loja/
The login process is being done, it just doesn't take the user to the intended page, the page gets stuck. This problem is happening to me with SEO enabled/disabled, with .htaccess or without .htaccess, it doesn't matter.
As for admin login I'm using Chrome to manage the store, the problem is for customer login, many people use firefox and they will have problems.
If anyone knows a solution for this problem, please help. Thanks!
I'm using the latest firefox version and opencart 1.5.1.3
http://www.chimarrao.com/loja/
- rmarques
- Posts: 9
- Joined: Fri Sep 10, 2010 1:30 am
Re: No access to admin after htaccess change [SOLVED]
check your config.php and admin/config.php urls are correct
post the contents of your .htaccess file here.
post the contents of your .htaccess file here.
Happy Coding!
Simon
------
Commercial Mods:
Google Merchant / Base XML Feed + Bing Shopping + Sitemaps - Automatic Friendly SEO URLs
Full List of UKSB Extensions and Mods
vQmod Generator - Develop & Test OpenCart on your Local Windows machine
Click here if I have helped you and you would like to make a donation
Simon
------
Commercial Mods:
Google Merchant / Base XML Feed + Bing Shopping + Sitemaps - Automatic Friendly SEO URLs
Full List of UKSB Extensions and Mods
vQmod Generator - Develop & Test OpenCart on your Local Windows machine
Click here if I have helped you and you would like to make a donation
-

uksitebuilder - Posts: 5602
- Joined: Thu Jun 09, 2011 3:37 pm
- Location: United Kindgom
Re: No access to admin after htaccess change [SOLVED]
Here you can see the exact problem I'm having. Fido-x has a demonstration store here http://dev151.fido-x.net/admin/
username/password: demo/demo
Try to access it using Firefox and Chrome to see the difference.
On Firefox the login process never ends, on chrome it works just fine.
Like I said before, the main problem is for customers who use firefox, they will have problems to access their accounts.
My .htaccess is original, but even with seo urls turned off and htaccess.txt the problem happens.
All urls in config.php are correct.
The image attached shows what happens with admin login after some minutes.
username/password: demo/demo
Try to access it using Firefox and Chrome to see the difference.
On Firefox the login process never ends, on chrome it works just fine.
Like I said before, the main problem is for customers who use firefox, they will have problems to access their accounts.
My .htaccess is original, but even with seo urls turned off and htaccess.txt the problem happens.
All urls in config.php are correct.
The image attached shows what happens with admin login after some minutes.
- rmarques
- Posts: 9
- Joined: Fri Sep 10, 2010 1:30 am
Re: No access to admin after htaccess change [SOLVED]
works fine for me using FireFox.
Happy Coding!
Simon
------
Commercial Mods:
Google Merchant / Base XML Feed + Bing Shopping + Sitemaps - Automatic Friendly SEO URLs
Full List of UKSB Extensions and Mods
vQmod Generator - Develop & Test OpenCart on your Local Windows machine
Click here if I have helped you and you would like to make a donation
Simon
------
Commercial Mods:
Google Merchant / Base XML Feed + Bing Shopping + Sitemaps - Automatic Friendly SEO URLs
Full List of UKSB Extensions and Mods
vQmod Generator - Develop & Test OpenCart on your Local Windows machine
Click here if I have helped you and you would like to make a donation
-

uksitebuilder - Posts: 5602
- Joined: Thu Jun 09, 2011 3:37 pm
- Location: United Kindgom
Re: No access to admin after htaccess change [SOLVED]
So it might be a problem with my version of firefox. I'll work on firefox to see what I can find. Thanks!
- rmarques
- Posts: 9
- Joined: Fri Sep 10, 2010 1:30 am
Re: No access to admin after htaccess change [SOLVED]
I uninstalled AVG antivirus and reinstalled it again. Now opencart login works fine on firefox. Looks like there was a conflict somewhere.
- rmarques
- Posts: 9
- Joined: Fri Sep 10, 2010 1:30 am
18 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 7 guests













