How to configure codeigniter for styles and images?

0

good day, I would like to know if someone can tell me how to configure the codeigniter so that it can be seen in an internal network and also know if it is with the same configuration or with another to put the page in a hosting.

for the css styles, I found a line to put in the .htaccess, but it did not work, this line;

RewriteCond $1 !^(index\.php|assets|css|robots.\txt)
    
asked by Macx 18.07.2018 в 20:04
source

1 answer

0

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.

    
answered by 18.07.2018 в 21:06