Htaccess issue (The page isn't redirecting properly)

#1
[eluser]Ninjabear[/eluser]
I've got my Code Igniter installation working now as per previous post, but the htaccess file is not working. I'm just using the recommended declaration of:

Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt|resources)
RewriteRule ^(.*)$ /index.php/$1 [L]

When I type www.danielsportfolio.co.uk/codeigniter/ The browser just hangs for ages and then gives me the message:

Code:
The page isn't redirecting properly
Firefox has detected that the server is redirecting the request for this address in a way that will never complete.
# This problem can sometimes be caused by disabling or refusing to accept cookies.

If I add in the index.php to the end like this www.danielsportfolio.co.uk/codeigniter/index.php then the page will load fine. If i add the main controller (in my case main) then it gives me the error as well.

How do I fix this please?

#2
[eluser]pickupman[/eluser]
Is the .htaccess file in the /codeigniter/ folder? And try clearing your browser's cache. I have had this issue when editing the .htaccess file, I had to clear the browser's cache then refresh the page.

#3
[eluser]Ninjabear[/eluser]
[quote author="pickupman" date="1270537920"]Is the .htaccess file in the /codeigniter/ folder? And try clearing your browser's cache. I have had this issue when editing the .htaccess file, I had to clear the browser's cache then refresh the page.[/quote]

Yes it is the htaccess in the code igniter folder. I have already tried clearing the browser cache but it doesn't solve the problem.

Is there a way of resetting the .htaccess file so that it doesn't take instructions from further up the tree?

#4
[eluser]rogierb[/eluser]
By the look of your url you have CI installed in a subfolder.
Code:
RewriteRule ^(.*)$ /index.php/$1 [L]
Will point to /index.php based on your root of www.danielsportfolio.co.uk/

If you want it to piont to www.danielsportfolio.co.uk/codigniter/ you need a Rewrite Base

Code:
RewriteBase /codeigniter/

You need to change the rewrite rule aswell, remove the slash:
Code:
RewriteRule ^(.*)$ index.php/$1 [L]

#5
[eluser]Ninjabear[/eluser]
[quote author="rogierb" date="1270575309"]By the look of your url you have CI installed in a subfolder.
Code:
RewriteRule ^(.*)$ /index.php/$1 [L]
Will point to /index.php based on your root of www.danielsportfolio.co.uk/

If you want it to piont to www.danielsportfolio.co.uk/codigniter/ you need a Rewrite Base

Code:
RewriteBase /codeigniter/

You need to change the rewrite rule aswell, remove the slash:
Code:
RewriteRule ^(.*)$ index.php/$1 [L]
[/quote]

Excellent help, it's working now. The only instance it doesn't work is if I put something like:

Code:
www.danielsportfolio.co.uk/codeigniter


It works in this instance though:
Code:
www.danielsportfolio.co.uk/codeigniter/

#6
[eluser]pickupman[/eluser]
The trailing slash tells your root folder that /codeigniter/ is a folder, and to load the default index file (ie index.php).

#7
[eluser]Ninjabear[/eluser]
I made this topic ages ago but I have further htaccess issues. I have looked at tutorials but I'm still no closer.

At the moment my site is at the root of my domain. I tried using the default htaccess file but with js and css added so I can keep them in the root:

Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt|resources|css|js)
RewriteRule ^(.*)$ /index.php/$1 [L]

When loading the site it loads fine and all pages will load but only if I add index.php/ to the end of the domain name. No errors in log file or page.

#8
[eluser]pickupman[/eluser]
Some servers want a question mark in the rule.
Code:
RewriteRule ^(.*)$ index.php?/$1 [L]

#9
[eluser]Ninjabear[/eluser]
[quote author="pickupman" date="1300497170"]Some servers want a question mark in the rule.
Code:
RewriteRule ^(.*)$ index.php?/$1 [L]
[/quote]

You legend! Thanks, works a treat, this thing's been giving me a headache all day.

#10
[eluser]pickupman[/eluser]
Great...one of the great things of programming...one single character can waste hours.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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