Post by dony_b » Sat Feb 25, 2012 12:07 am

Is it possible to rename index.php or move it to a another folder so that its not on the root directory ?

For example change it to oc-index.php

or move it to a new folder /config/index.php
Last edited by dony_b on Mon Feb 27, 2012 10:39 pm, edited 1 time in total.

User avatar
Active Member

Posts

Joined
Wed Aug 18, 2010 9:56 pm
Location - Boston, MA

Post by i2Paq » Sat Feb 25, 2012 12:33 am

Search results for: rename index.php.

Norman in 't Veldt
Moderator OpenCart Forums

_________________ READ and Search BEFORE POSTING _________________

Our FREE search: Find your answer FAST!.

[How to] BTW + Verzend + betaal setup.


User avatar
Global Moderator

Posts

Joined
Mon Nov 09, 2009 7:00 pm
Location - Winkel - The Netherlands

Post by dony_b » Sat Feb 25, 2012 12:38 am

For your info I always search the forum before I post anything...ive used OC long enough to know that. So thanks for showing me how to use google and not contribute to this support forum.

User avatar
Active Member

Posts

Joined
Wed Aug 18, 2010 9:56 pm
Location - Boston, MA

Post by i2Paq » Sat Feb 25, 2012 12:42 am

dony_b wrote:For your info I always search the forum before I post anything...ive used OC long enough to know that. So thanks for showing me how to use google and not contribute to this support forum.
And have you actually read any of the search results and what answer did you find that did not tell you what you probably found out yourself by trying to rename the index.php?
Did you even tried that, and did you try to move it to another folder?

What was the outcome of your reading and trying?

Norman in 't Veldt
Moderator OpenCart Forums

_________________ READ and Search BEFORE POSTING _________________

Our FREE search: Find your answer FAST!.

[How to] BTW + Verzend + betaal setup.


User avatar
Global Moderator

Posts

Joined
Mon Nov 09, 2009 7:00 pm
Location - Winkel - The Netherlands

Post by dony_b » Sat Feb 25, 2012 12:47 am

Of course I tried renaming it and moving to a new folder and it does not work. I figured someone here might have done this already.

User avatar
Active Member

Posts

Joined
Wed Aug 18, 2010 9:56 pm
Location - Boston, MA

Post by i2Paq » Sat Feb 25, 2012 12:50 am

Next time you should mention that you have searched, what you have tried and if it failed (or not).

The more info you give, the greater the chance is that you get a to-the-point answer.

As far as I have tried and heard you cannot do what you want to do without a lot of coding (if you even will succeed).

Norman in 't Veldt
Moderator OpenCart Forums

_________________ READ and Search BEFORE POSTING _________________

Our FREE search: Find your answer FAST!.

[How to] BTW + Verzend + betaal setup.


User avatar
Global Moderator

Posts

Joined
Mon Nov 09, 2009 7:00 pm
Location - Winkel - The Netherlands

Post by dony_b » Sat Feb 25, 2012 1:06 am

It would have been easier if you had told me this form the start instead of trying to give me a lesson in how to use the forum....wasting both of our time

User avatar
Active Member

Posts

Joined
Wed Aug 18, 2010 9:56 pm
Location - Boston, MA

Post by JAY6390 » Sat Feb 25, 2012 1:11 am

It's possible to move/rename sure, but to what end do you want to do so?

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by dony_b » Sat Feb 25, 2012 1:18 am

JAY6390 wrote:It's possible to move/rename sure, but to what end do you want to do so?
I have another application in the root directory that has index.php so im trying to either rename the one one from OC or move to another folder. Do I need to change all occurrences where index.php is being if I was to change or move it.

User avatar
Active Member

Posts

Joined
Wed Aug 18, 2010 9:56 pm
Location - Boston, MA

Post by JAY6390 » Sat Feb 25, 2012 1:21 am

If you're on 1.5.X then this should be less of a problem. You can use the url class to make the right urls, and just change the index.php file to a new name. You would also need to amend the rule in .htaccess

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by dony_b » Sat Feb 25, 2012 1:24 am

Yes its 1.5.X

Do I need to change any other occurrences in the library or config ? Or just add the url class and change it in the htaccess

User avatar
Active Member

Posts

Joined
Wed Aug 18, 2010 9:56 pm
Location - Boston, MA

Post by JAY6390 » Sat Feb 25, 2012 1:32 am

config shouldn't be an issue. I've just done a grep, and there are actually 97 instances over 37 files on my local copy (15131). The problem is the url class is only used for certain areas, where as it should be done throughout the cart. if you have a good search replace tool like grepwin you could do it in no time. Be careful not to rename the admin index.php instance, there are far more in that folder, and of course you shouldn't need to edit that index file

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by Qphoria » Sat Feb 25, 2012 3:25 am

Try this....

(1.5.x ONLY)

1. rename index.php to ocindex.php

2. Edit .htaccess and add to the top:

Code: Select all

DirectoryIndex ocindex.php
3. Global Replace "index.php" with "ocindex.php" in the opencart "catalog" and "system" folders only, filtering on php and tpl files.

You will likely have to do this locally unless you know how to do it with linux SSH.
If you do it locally, change the files and reupload them over your existing files. There are 35 files in the catalog folder and 1 file in the system folder.

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by JAY6390 » Sat Feb 25, 2012 3:32 am

It stands to reason that if the url class is rewritten to use ocindex.php, then all of the admin files will need to be rewritten too, as it uses the url class

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by Qphoria » Sat Feb 25, 2012 4:56 am

JAY6390 wrote:It stands to reason that if the url class is rewritten to use ocindex.php, then all of the admin files will need to be rewritten too, as it uses the url class
that does stand to reason. I never tested it.. just saying to try it. In which case then run the global replace across the WHOLE thing.

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by JAY6390 » Sat Feb 25, 2012 5:55 am

Yeah. Renaming both index.php files to ocindex.php, then replace all index.php text across all OC files

On a clean 1505 (old yes I know) I get 253 matches over 86 files...so there's quite a few bits to change, but it is possible to do definitely

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by dony_b » Sat Feb 25, 2012 10:49 am

Qphoria wrote:Try this....

(1.5.x ONLY)

1. rename index.php to ocindex.php

2. Edit .htaccess and add to the top:

Code: Select all

DirectoryIndex ocindex.php
3. Global Replace "index.php" with "ocindex.php" in the opencart "catalog" and "system" folders only, filtering on php and tpl files.

You will likely have to do this locally unless you know how to do it with linux SSH.
If you do it locally, change the files and reupload them over your existing files. There are 35 files in the catalog folder and 1 file in the system folder.
I wonder if this is going to affect other mods or vqmod files ?

User avatar
Active Member

Posts

Joined
Wed Aug 18, 2010 9:56 pm
Location - Boston, MA

Post by Renato Frota » Sat Feb 25, 2012 2:42 pm

I'm wondering why you need 2 applications running in the same folder and also how renaming index.php to ocindex.php will make your other application usable if you need to set default index of the directory to ocindex.php anyway to achieve a functional opencart (because of the high number of urls generated without index.php - or renamed ocindex.php)?

You will still need to hardcode index.php in URL to your other system! Then it's definitelly easier to hardcode othersystemindex.php and leave opencart as is, as OpenCart will be the default for url.com/ (without filename) in any case!

New member

Posts

Joined
Wed Aug 31, 2011 1:21 pm

Post by dony_b » Sun Feb 26, 2012 12:34 am

JAY6390 wrote:Yeah. Renaming both index.php files to ocindex.php, then replace all index.php text across all OC files

On a clean 1505 (old yes I know) I get 253 matches over 86 files...so there's quite a few bits to change, but it is possible to do definitely
It looks like a quite a few instances to change and might not be worth. Im thinking to create a wildcard subdomain to separate the two apps so I dont have to rename anything.

Lets say I create a subdomain test.domain.com and have the docroot /test/ then redirect it to the primary domain so I keep the same url structure the same.
Add this to .htaccess

Code: Select all

RewriteBase /
RewriteCond %{HTTP_HOST} =test.domain.com
RewriteRule ^.*   test/$0   [L]
will this work ?

User avatar
Active Member

Posts

Joined
Wed Aug 18, 2010 9:56 pm
Location - Boston, MA

Post by JAY6390 » Sun Feb 26, 2012 12:38 am

Perhaps we're going about this the wrong way :)

Can you explain why you need both apps in the same folder please?

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom
Who is online

Users browsing this forum: Bing [Bot] and 125 guests