• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
htaccess problem with sub pages

#1
[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

#2
[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>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
and in your webserver log where are you being send?

#3
[eluser]n0xie[/eluser]
Quote:I put a exit() on the first line of the index.php which didn’t get called
How can you generate output when the index.php isn't called?

#4
[eluser]vmcgreevy[/eluser]
http://localhost/site/news

With the default file:

An Error Was Encountered

The URI you submitted has disallowed characters.

#5
[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.

#6
[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?

#7
[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???

#8
[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.*
  RewriteRule ^(.*)$ /index.php?/$1 [L]

Try couger's htaccess.

#9
[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????

#10
[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


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.