Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9244405
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T09:01:18+00:00 2026-06-18T09:01:18+00:00

I recently had to move a CodeIgniter based website from the web root of:

  • 0

I recently had to move a CodeIgniter based website from the web root of:

/var/www/vhosts/dev/

to:

/var/www/vhosts/dev/site1/

The problem I am encountering is that I need the web root to still remain accessible from the domain: http://www.devdomain.com

All relative links now are broken since they obviously were referring to the web root.
Is there a rewrite rule or something at the top-level I can use that will automatically add the site1/ to all relative based links?

So, what would have normally been;

<a href="/enrollment">Enrollment</a>
https://www.devdomain.com/enrollment

Now needs to become;

<a href="/enrollment">Enrollment</a>
https://www.devdomain.com/site1/enrollment

Any help would be extremely appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T09:01:20+00:00Added an answer on June 18, 2026 at 9:01 am

    The $config[‘base_url’] fix Nikola mentions would work if you used, in your links, the

    <a href="<?php echo base_url(); ?>/enrollment">Enrollment</a>
    

    Since apparently you don’t want to go through the code the problem isn’t in Codeigniter but in the server (?). Maybe a RewriteRule in the .htaccess file can help you (if you’re on Apache).

    I can’t comment other answers since my rep level is low, otherwise I would’ve simply commented on Nikola’s answer.

    EDIT: I just figured this out. You have to remove the initial “/” from the href attributes! It is going to the root of the webserver, it is being a relative link but not the way you think. If you remove the “/” the link will go to a file on the same directory level of your file (in this case the Codeigniter installation). Sorry but you’ll have to go through your whole code.

    Additionally I would recommend for you to use site_url() to link between controllers inside Codeigniter, helps with this kind of situations and a lot others.

    SECOND EDIT: It’s not site_url() but base_url(), sorry for the confusion. Just corrected the code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have recently had to move my project from using the CPython 2.6 interpreter
I recently had to move my database from SQL Studio over to Oracle and
I recently had to rewrite our rest api, and made the switch from Flask
We have recently moved to a new web server (from IIS6 to IIS7.5) and
My boss recently asked me if I could move our website outside of the
We recently had a web app that went out to site acceptance testing where
I recently had to move a database(sql server 2008) to a different server, and
I recently had to re-factor some code from a previous maintainer and initially I
I recently had a problem when comparing two NSURLs and compare one NSURL with
I recently had to reinstall the OS on my dev box and I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.