htaccess problem with sub pages - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: htaccess problem with sub pages (/showthread.php?tid=31331) |
htaccess problem with sub pages - El Forum - 06-15-2010 [eluser]vmcgreevy[/eluser] I have a codeigniter site set up, e.g. http://localhost/site The homepage works fine, but when I click on any sub links e.g. http://localhost/site/news codeigniter pulls in http://localhost even though the url is http://localhost/site/news I put a exit() on the first line of the index.php which didn't get called, which is showing that htaccess is sending me to the wrong page. $config['uri_protocol'] is set to auto, and I tried each setting under this, and my $config['base_url'] is "http://localhost/site/"; My htaccess looks like this: RewriteCond %{REQUEST_URI} ^system.* RewriteRule ^(.*)$ /index.php?/$1 [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !^(/index\.php|/img|/js|/css|/broadcaster|/robots\.txt|/favicon\.ico) RewriteRule ^(.*)$ /index.php/$1 [L] Has anyone got any ideas? Thanks htaccess problem with sub pages - El Forum - 06-15-2010 [eluser]Clooner[/eluser] [quote author="vmcgreevy" date="1276611338"]Has anyone got any ideas? Thanks[/quote] How does it work when you use a default htaccess? Code: <IfModule mod_rewrite.c> htaccess problem with sub pages - El Forum - 06-15-2010 [eluser]n0xie[/eluser] Quote:I put a exit() on the first line of the index.php which didn’t get calledHow can you generate output when the index.php isn't called? htaccess problem with sub pages - El Forum - 06-15-2010 [eluser]vmcgreevy[/eluser] http://localhost/site/news With the default file: An Error Was Encountered The URI you submitted has disallowed characters. htaccess problem with sub pages - El Forum - 06-15-2010 [eluser]vmcgreevy[/eluser] [quote author="n0xie" date="1276611701"] How can you generate output when the index.php isn't called?[/quote] The homepage works fine, but htaccess is stopping the index.php page being called at all when I try to load a subpage. htaccess problem with sub pages - El Forum - 06-15-2010 [eluser]Clooner[/eluser] Again what does your server log file say? This will give you a good idea what is wrong! and are you sure that mod_rewrite is enabled? htaccess problem with sub pages - El Forum - 06-15-2010 [eluser]vmcgreevy[/eluser] [quote author="clooner" date="1276612340"]Again what does your server log file say? This will give you a good idea what is wrong! and are you sure that mod_rewrite is enabled?[/quote] error log: File does not exist: C:/wamp/www/site/news Yeah the rewrite module is enabled in Apache I changed RewriteRule ^(.*)$ index.php?/$1 [L] to RewriteRule ^(.*)$ site/index.php?/$1 [L] Homepage works fine again this way expect the sub pages im getting: An Error Was Encountered The URI you submitted has disallowed characters. This was for http://localhost/site/news $config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-'; Don't see what is wrong with 'news', a-z??? htaccess problem with sub pages - El Forum - 06-15-2010 [eluser]n0xie[/eluser] [quote author="vmcgreevy" date="1276611735"]http://localhost/site/news With the default file: An Error Was Encountered The URI you submitted has disallowed characters.[/quote] Is most likely caused by: Code: RewriteCond %{REQUEST_URI} ^system.* Try couger's htaccess. htaccess problem with sub pages - El Forum - 06-15-2010 [eluser]vmcgreevy[/eluser] With the default htaccess, i still get this for subpages: http://localhost/site/sitemap An Error Was Encountered The URI you submitted has disallowed characters. Config: $config[‘permitted_uri_chars’] = ‘a-z 0-9~%.:_\-’; Why can't it do what it is supposed to???? htaccess problem with sub pages - El Forum - 06-15-2010 [eluser]Clooner[/eluser] [quote author="vmcgreevy" date="1276613269"]With the default htaccess, i still get this for subpages: http://localhost/site/sitemap An Error Was Encountered The URI you submitted has disallowed characters. Config: $config[‘permitted_uri_chars’] = ‘a-z 0-9~%.:_\-’; Why can't it do what it is supposed to????[/quote] Try removing the question mark after index.php in your htaccess as suggested before |