For both cases with the same configuration should work, what you should, you should change the .htaccess
for the next, since it will not work as you have it:
.htaccess
RewriteEngine on
RewriteCond $1 !^(index\.php|images|php|script|styles|js|css)
RewriteRule ^(.*)$ /index.php/$1 [L]
And then configure a VirtualHost to be able to use it locally or within the same network.
From windows, with xampp, you can access C:\xampp\apache\conf\extra\httpd-vhosts.conf
(or where the xampp is installed) and type the following:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName ejemplo.com
ServerAlias www.ejemplo.com
DocumentRoot C:\xampp\htdocs\CarpetaCodeigniter
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Then in the file hosts
of windows in C:\Windows\System32\drivers\etc\hosts
add at the end:
127.0.0.1 www.ejemplo.com
And with that you will be able to access from any browser to that URL and it is useful when you need to implement that to a server, except that those steps would no longer be necessary.
Note : that htaccess does hide the index.php
of the url and makes it more friendly.