Ajax + Codeigniter

2

Good morning ....

I just implemented Codeigniter, but I can not use a friendly url ...

I try to pass parameters through Ajax, but I can not because of URLs.

I already removed the index.php from the file config.php and changed the routs.php

I have already inserted the following code in htaccess

RewriteEngine on

RewriteCond $1 !^(index\.php|assets|robots\.txt)

RewriteRule ^(.*)$ index.php/$1 [L]]  
    
asked by anonymous 16.05.2016 / 16:59

1 answer

1

To make the server work with a friendly URL you need, in addition to activating the mod_rewrite module, also enable the AllowOverride directive ( read here ) in the hosting directory.

Just a tip: Everything a htaccess does, Apache should do with configuration files, and pass commands through configuration files is safer ( the developer says this ). Knowing this, it may be best to set this up in the same general server file. So:

<Directory "/var/www/html/seu_sistema">
Options -Indexes
DirectoryIndex index.php index.html
AllowOverride All
RewriteEngine on
RewriteCond $1 !^(index\.php|assets|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]
</Directory>

Have you seen how AllowOverride All is set? It is.

NOTE: With this setting, you no longer need to use .htaccess.

    
20.09.2016 / 19:42