Change root access of a website (PHP)(WordPress)

I need help as i am new to web development. I have a website which has both “application” folder and a “demo” folder on server. The APPLICATION folder contains the codeigniter files which are accessible as i give url: ‘www.example.com’ and the DEMO folder contains the wordpress site which is accessible as ‘www.example.com/demo’. now i want to change the access to wordpress when url ‘www.example.com’ is typed in, i want to load my wordpress site (PLACED IIN DEMO FOLDER). and rest will remain as it is working properly.
Kindly do tell me what changes need to be changed in order to achieve the mentioned goal. Thanks

Related posts

2 comments

  1. This can not be done – You would have both your Codeigniter App and your WordPress app under http://www.example.com/

    I am guessing that you want this:

    and

    If that’s the goal, this are the steps:

    • Make a Backup!
    • Create a folder /xyz
    • Move the following assets to the new folder:

      • /system => /xyz/system
      • /application => /xyz/application
      • /index.php => /xyz/index.php
    • Open the /xyz/index.php and edit the following lines:

      • $system_path = 'system'; => $system_path = '/xyz/system';
      • $application_folder = 'application'; => $application_folder = '/xyz/application';

    As I don’t know anything about the Codeigniter App that you have there might be potential issues, such as:

    • If your app uses assets (css files, images, js etc) it might have trouble finding them after the move. You will need to edit your View files accordingly. You can probably find them under /xyz/application/views

    • There is a good chance that you have a hidden file /.htaccess which contains configuration to exclude the index.php from your Codeigniter URI Scheme. (Navigate into your codeigniter app and pay attention to the URL while you navigate through the app. Does the URL look like

    • (a) http://www.example.com/index.php/something/else

    • (b) http://www.example.com/something/else

    If (b) is the case you will have to adjust your .htaccess file too.

    Hope this helps as a starting point….Good luck! 🙂

  2. Use base_url(); to get present url

    $url = base_url(); // check url.. echo it
    
    if($url == "www.example.com")
    { 
     redirect('www.example.com/demo', 'refresh');
    }
    

    **

    Add this code at your header on to the top

    **

Comments are closed.