Welcome Guest, Not a member yet? Register   Sign In
CRUDIgniter URLs and 404
#1

Good morning all

I have been through quite a number of the posts on this forum looking for an answer but despite dozens of attempts I am still stuck

I created a new CI project on Ubuntu 18.04 using apache2, php 7.2 and MySQL into /var/www/html/scribe

Before I did anything else I went to http://myserver/scribe and was presented with the CI default page

Next I used CRUDIgniter to generate code for a few tables in MySQL database and downloaded the code and merged it into /var/www/html/scribe

When I go to http://myserver/scribe I am now presented with a page with my tables in the left had bar which expand on clicking to Add and Listing. Looks very promising

If I hover over the Add link it shows http://192.168.2.128/scribe/order/add

This link does not work and returns a 404 Not Found

Two questions, therefore, first why has the server name been changed to the IP Address and second is the link /scribe/order/add correct as it seems like it ought to be http://myserver/scribe/index.php?order/add which works (well it displays the correct screen).

I have an .htacess in /var/www/html/scribe which contains a simple rewrite rule
<IfModule mod_rewrite.c>
    RewriteEngine on

    RewriteCond %{REQUEST_FILENAME} !-f

    RewriteCond %{REQUEST_FILENAME} !-d

    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>



Any pointers would be much appreciated

Regards
Paul
Reply
#2

You haven't set a base url in /application/config/config.php, so Codeigniter are trying to guess your url. And it will default to your network cards ip-adress.

CodeIgniter generates SEO friendly urls, that's why you are not seeing index.php in your url. It's per design.

Does this url, or is it broken as well?
http://myserver/scribe/order/add
Reply
#3

Hi jreklunbd

I did have the base_url set but I didn't have a working mod_rewrite which was causing me all my problems. Sorted out the mod_rewrite and all is now working as expected. Many thanks for replying

Regards
Paul
Reply




Theme © iAndrew 2016 - Forum software by © MyBB