Post by markz » Mon Aug 19, 2013 11:27 am

I just made a fresh install of OpenCart and need to change the name of the admin folder to another name for improving my online shop's security. I noticed several config.php files in various locations. Which of these config.php files needs to be edited to indicate the correct file path and location, and exactly what lines in the file need to be edited?

Thanks,
Mark

v.3.0.2.0
-------------
also v.1.5.6
with vqmod 2.5.1


Active Member

Posts

Joined
Mon Aug 19, 2013 8:14 am

Post by k2tec » Mon Aug 19, 2013 3:43 pm

that's a good plan.
Change in your admin config.php everything what's called admin to your admin dir name.
sample

Code: Select all

define('HTTP_SERVER', 'http://localhost/1551/admin/');
to

Code: Select all

define('HTTP_SERVER', 'http://localhost/aldoc1551/yourdir/');

Code: Select all

define('DIR_APPLICATION', 'C:\Program Files (x86)\Zend\Apache2\htdocs\1551/admin/');
to

Code: Select all

define('DIR_APPLICATION', 'C:\Program Files (x86)\Zend\Apache2\htdocs\1551/yourdir/');
Beware if you want to use VqMod. You have to chance it in the VqMod to.

User avatar
Active Member

Posts

Joined
Mon Apr 12, 2010 8:06 pm

Post by sytra » Mon Aug 19, 2013 4:16 pm

Yes, if you have VQmod you are only supposed to have to change the path redirect file, however, for some reason this has never worked for us, have tried numerous times on 1.5.5.1, so in the end resorted to changing all refs to admin in vqmod xml files to the new file name

Running OC 1.5.5.1 with vqmods.
http://www.aislings.co.uk
http://www.lovers-paradise-toys.co.uk


Active Member

Posts

Joined
Sat Feb 04, 2012 6:27 am

Post by k2tec » Mon Aug 19, 2013 4:26 pm

If you have vqmod you have to change the path to.
sample:

Code: Select all

<file name="admin/controller/sale/order.php">
to

Code: Select all

<file name="yourdirname/controller/sale/order.php">
If you have good editor than it is now problem.
Also clear ( delete al files in) the vqcache

User avatar
Active Member

Posts

Joined
Mon Apr 12, 2010 8:06 pm

Post by markz » Tue Aug 20, 2013 12:31 am

I don't have vqmod installed. Since a lot of you seem to have problems with it, do you feel it's really worth installing? I'm using the latest version of OpenCart...v.1.5.6

v.3.0.2.0
-------------
also v.1.5.6
with vqmod 2.5.1


Active Member

Posts

Joined
Mon Aug 19, 2013 8:14 am

Post by k2tec » Tue Aug 20, 2013 1:22 am

VqMod is handy to install extensions, but it's beter to make it hardcored.
But if you want to run the latest version every time then install vqmod.

User avatar
Active Member

Posts

Joined
Mon Apr 12, 2010 8:06 pm

Post by markz » Tue Aug 20, 2013 11:12 am

I installed vqmod because I think I will upgrade to newer versions of OpenCart as it is developed, and I don't want to lose the website that I build.

I still need to change the admin folder names to improve security. I do have a good editor but I don't have a lot of experience coding or changing code. Is there a way to batch process the necessary files to modify them, or am I going to have to go through the files one at a time?

If I have to go through the files one at a time, then can any of you tell me ALL the files I will need to modify? Do I only have to modify these files?...

admin/config.php
vqmod/install/index.php

In the file vqmod/pathReplaces.php there is the following code...

/**
* File for path replacements in xml paths. Examples:
*
* $replaces[] = array('~^admin\b~', 'admin123'); // This replaces the admin folder name for use when admin folder's renamed
* $replaces[] = array('~\btheme/default\b~', 'theme/my-theme-name'); // Theme name replace to apply mods to your theme
*
* Place your replaces between the START and END lines below
**/


// START REPLACES //

// END REPLACES //


Do I need to modify anything in this file?

v.3.0.2.0
-------------
also v.1.5.6
with vqmod 2.5.1


Active Member

Posts

Joined
Mon Aug 19, 2013 8:14 am

Post by butte » Tue Aug 20, 2013 12:23 pm

It is already running. If you rename the directory /admin/ to /othername/, then both the file /config.php and the file /othername/config.php need to know about it. Inside both of those, change every instance of "admin" to "othername". (In a decent text editor that would be change all in all files, one pass, done.)

You can then simply replace both /index.php and /admin/index.php with the original virgin index.php files (from the OC .zip file's /upload/ directory, then in the browser address and fire /vqmod/install/index.php, whereupon a moment later vqmod will have instantly rewritten its own stuff. (You do not even need a decent text editor, let vqmod do it.)

Guru Member

Posts

Joined
Wed Mar 20, 2013 6:58 am

Post by k2tec » Tue Aug 20, 2013 10:55 pm

Still learning, I see the file pathReplaces in the new VqMod.

but as I said I do'nt use Vqmod often.

User avatar
Active Member

Posts

Joined
Mon Apr 12, 2010 8:06 pm

Post by markz » Tue Aug 20, 2013 11:07 pm

butte wrote: If you rename the directory /admin/ to /othername/, then both the file /config.php and the file /othername/config.php need to know about it.

Is the first config.php file you mention found in the main OpenCart directory? I see one there but there are no instances of "admin" in this particular config.php file.

However, I do see instances of "admin" in the /othername/config.php file.

v.3.0.2.0
-------------
also v.1.5.6
with vqmod 2.5.1


Active Member

Posts

Joined
Mon Aug 19, 2013 8:14 am

Post by markz » Wed Aug 21, 2013 12:01 am

I just made a mistake and now I can't log in to my admin panel. I enabled SSL for the storefront by going to System → Settings and Edit for the default store. Under the Server tab I set Use SSL to Yes. How do I go about repairing this since I can't log in?

I was using the information from this article to upgrade security when I made the above mistake:

http://opencarthelp.com/a/?q=improve-opencart-security

Apparently my host doesn't have a shared ssl layer. I edited the admin config.php file located at:

/admin/config.php

These are the lines I changed...

// HTTPS
define('HTTPS_SERVER', 'http://mystoreurl.com/admin/');
define('HTTPS_CATALOG', 'http://mystoreurl.com/image/');

Change http: to https: in the path:

// HTTPS
define('HTTPS_SERVER', 'https://mystoreurl.com/admin/');
define('HTTPS_CATALOG', 'https://mystoreurl.com/image/');


I "think" I'm going to have to make an .htaccess file. Is this correct? If so, is there an .htaccess file I can download somewhere, or am I going to have to create one?
Last edited by markz on Wed Aug 21, 2013 12:13 am, edited 2 times in total.

v.3.0.2.0
-------------
also v.1.5.6
with vqmod 2.5.1


Active Member

Posts

Joined
Mon Aug 19, 2013 8:14 am

Post by butte » Wed Aug 21, 2013 12:02 am

Yes, one is in the OC root (same directory as index.php), the other one is in the administrative directory one step up, in /admin/ where the other index.php sits. Cart and admin each have a config.php and an index.php (OC sits in / or /ocdir/ and admin sits in /admin/ or /ocdir/admin/).

When you find that pair of config.php (one a step above the other in the tree), then both need to know where OC and admin sit, such as /othername/ and /othername/admin/. You're not snowed, you're just becoming familiar with the directory structure. Slow and easy, putter a bit, you'll see it.

Guru Member

Posts

Joined
Wed Mar 20, 2013 6:58 am

Post by butte » Wed Aug 21, 2013 12:07 am

"Ulp." Actually, no, you can get in. Do you have local copies of your two (now immediately) CURRENT config.php files? If not, download those first.

Guru Member

Posts

Joined
Wed Mar 20, 2013 6:58 am

Post by markz » Wed Aug 21, 2013 12:18 am

I just edited them via the Cpanel at my webhost but it didn't work. I still can't get in, so I just downloaded them as per your suggestion. Now what?

Yes...I'm learning (and today I'm learning a LOT!) :o

v.3.0.2.0
-------------
also v.1.5.6
with vqmod 2.5.1


Active Member

Posts

Joined
Mon Aug 19, 2013 8:14 am

Post by butte » Wed Aug 21, 2013 12:27 am

What do the HTTPS sections say? [Now, that is.]
Last edited by butte on Thu Aug 22, 2013 2:23 am, edited 2 times in total.

Guru Member

Posts

Joined
Wed Mar 20, 2013 6:58 am

Post by butte » Wed Aug 21, 2013 12:31 am

I just noticed something. Renaming /admin/ to /othername/ leaves OC where it was, you're just changing the name of where admin sits. At the moment, whether that is already renamed or not, the HTTPS sections need to agree with it and should not be protecting it.

You will turn the htaccess.txt file into the .htaccess file by renaming, but wait for the moment before doing that.

Guru Member

Posts

Joined
Wed Mar 20, 2013 6:58 am

Post by butte » Wed Aug 21, 2013 12:50 am

Simpler . . . what are the earliest backups you have of the two config.php files?

If you happen not to have backups, then refiring the installer should snuff the SSL booboo . . . you would need to be sure that /admin/ is named /admin/, reinstate the ORIGINAL config and index files, refire the OC installer, then rerun the vqmod installer.

Unfortunately, that link you read did not forewarn you not to interleave doing this and that, just do one, then the next. Renaming /admin/ and concurrently hitting SSL before the former was done was one booboo, many of us would say that protecting admin with SSL is itself a booboo. You dinna know.

Afterward, inside the htaccess.txt file specify any directory change for the OC root (it will end in /, and it will be either / or /directory/, NOT the /admin/ directory), then turn the htaccess.txt file into the .htaccess file by renaming (note the nonameDOTextension format). It will be a good idea NOT to let SSL protect /admin/.

Guru Member

Posts

Joined
Wed Mar 20, 2013 6:58 am

Post by markz » Wed Aug 21, 2013 5:17 am

Since this was/is a fresh install I had not backed up yet since I really haven't built anything.

I've renamed my admin folder back to admin, and reinstated the config.php files to their original configuration.

I've refired an installer and have acquired my login page, but when I log in I receive the error message "404: File Not Found"

Hmm...you say refire the OC installer. How do I do this? My webhost had OC on it and when I initially installed it I only had to press an install button. The rest was automated. I tried installing by running http://my url/OpenCart/install but get the same 404 File Not Found error message.

I've run the vqmod install again and the system tells me "VQMOD ALREADY INSTALLED!"

I'm holding back on doing anything with the htaccess.txt file until later, unless I'm told I need to do otherwise!

v.3.0.2.0
-------------
also v.1.5.6
with vqmod 2.5.1


Active Member

Posts

Joined
Mon Aug 19, 2013 8:14 am

Post by butte » Wed Aug 21, 2013 5:36 am

When you start with the stock config.php pair AND the stock index.php pair, first /install/index.php rewrites both config,php, and then (do wait, do it second) /vqmod/install/index.php rewrites both main OC and admin OC index.php. The former reinstated your log-in page but something SEEMS missing, while the latter knows where the index.php are. You may need just to flush vqmod/vqcache/ files so that it doesn't remember anything about its recent adventures, and then the 404 won't fire. (The stock files are in the OC .zip /upload/ tree.)

Retry, just put back in stock config.php and stock index.php, flush, then install OC and then install vqmod. After that is stable, then you'll want .htaccess in place to protect it in certain ways.

Which version did the host routine install?

Guru Member

Posts

Joined
Wed Mar 20, 2013 6:58 am

Post by markz » Wed Aug 21, 2013 5:47 am

Okay, well I decided to simply uninstall and reinstall OC on my webhost. Since it was a new install I didn't lose anything, and I learned some important lessons. I'm definitely going to slow down and ask questions before jumping ahead of myself as I did here...won't be able to afford these kinds of mistakes once my new site is live.

Anyway, I'm back at square one, where I'll work on changing the admin folder name to improve security. I do have vqmod reinstalled, and I'd certainly like to have the important administrative stuff accomplished before I begin building my catalog.

v.3.0.2.0
-------------
also v.1.5.6
with vqmod 2.5.1


Active Member

Posts

Joined
Mon Aug 19, 2013 8:14 am
Who is online

Users browsing this forum: Majestic-12 [Bot] and 67 guests