Welcome Guest, Not a member yet? Register   Sign In
Remove index.php from URL
#7

(This post was last modified: 04-30-2015, 01:03 PM by ivantcholakov. Edit Reason: Address )

@eci35

Before: http://my-site.com/index.php/
Now: http://my-site.com/

The browser interprets the additional segment index.php as an additional directory level. If in your code you are using relative links to your css, js, images, etc., they would become broken after removing the segment index.php. Use absolute URLs.

Code:
<img src="<?php echo base_url('assets/img/my-image.png'); ?>" />

If you insist on relative links, there is another trick by using the tag <base href="<?php echo base_url(); ?>" /> within the document head, but I don't use it, it brings side-effects on anchor links.
Reply


Messages In This Thread
Remove index.php from URL - by eci35 - 04-30-2015, 12:01 AM
RE: Remove index.php from URL - by wolfgang1983 - 04-30-2015, 12:10 AM
RE: Remove index.php from URL - by eci35 - 04-30-2015, 12:25 AM
RE: Remove index.php from URL - by gard_olsen - 04-30-2015, 07:03 AM
RE: Remove index.php from URL - by CroNiX - 04-30-2015, 08:01 AM
RE: Remove index.php from URL - by eci35 - 04-30-2015, 12:25 PM
RE: Remove index.php from URL - by ivantcholakov - 04-30-2015, 01:01 PM
RE: Remove index.php from URL - by eci35 - 04-30-2015, 01:38 PM
RE: Remove index.php from URL - by ivantcholakov - 04-30-2015, 01:54 PM
RE: Remove index.php from URL - by CroNiX - 04-30-2015, 02:12 PM
RE: Remove index.php from URL - by madaan_tushar - 05-25-2015, 07:40 AM



Theme © iAndrew 2016 - Forum software by © MyBB