0

I created a small site usign CI and theme (only the content change). In the first run, it works perfectly but when I click another link the view change but the url doesn't. this is my .htaccess content `

<IfModule mod_rewrite.c>
  Options +FollowSymlinks
  RewriteEngine on
  RewriteBase /CodeIgniter_2.1.4/
  RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico)
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ /CodeIgniter_2.1.4/index.php?/$1 [L]
</IfModule>

`

and in my config:

$config['base_url'] = 'http://localhost/CodeIgniter_2.1.4/'; $config['index_page'] = '';

this is the content of my routes:

$route['default_controller'] = "welcome"; $route['test'] = 'welcome/test';

and here is my link: <a href="test">Contact</a>

is anyone can help me please? Thanks in advance (Sorry for my bad english :) )

15
  • can you check this - $config['uri_protocol'] = 'AUTO'; Apr 6, 2014 at 8:22
  • Can you please check with this - Options +FollowSymlinks RewriteEngine on RewriteBase /CodeIgniter_2.1.4/ RewriteCond $1 !^(index\.php|resources|robots\.txt) RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L,QSA] Apr 6, 2014 at 8:50
  • still the same result, the view changes but not the url Apr 6, 2014 at 8:55
  • can you check with this - $config['uri_protocol'] = 'REQUEST_URI'; Apr 6, 2014 at 8:59
  • I get an 500 status code Apr 6, 2014 at 9:01

1 Answer 1

0

please look at the below and it's working at my localhost

config.php
=======================
$config['base_url'] = '';
$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';
$config['url_suffix'] = '';
$config['language'] = 'english';
$config['charset'] = 'UTF-8';


.httacces
=======================

#Initialize mod_rewrite
RewriteEngine On

# Put your installation directory here:
# If your URL is www.example.com/, use /
# If your URL is www.example.com/site_folder/, use /site_folder/
RewriteBase /CodeIgniter_2.1.4/

# Do not enable rewriting for files or directories that exist
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d


#For reuests that are not actual files or directories,
#Rewrite to index.php/URL
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s(.*)/index\.php [NC]
RewriteRule ^ /%1 [R=301,L]
2
  • my view changes perfectly but not the url. It still show the base url in the browser Apr 6, 2014 at 9:45
  • it works. the probleme is due to angularjs. when I remove the ng-app from my page, it works. Apr 9, 2014 at 8:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.