CodeIgniter Forums
.htaccess causing weird redirect issues? - 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 causing weird redirect issues? (/showthread.php?tid=34161)

Pages: 1 2


.htaccess causing weird redirect issues? - El Forum - 09-21-2010

[eluser]Corey Freeman[/eluser]
So I used the generic code from the documentation:

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

however, that's just causing it to redirect to the default controller...

http://www.cloudreve.com
http://www.cloudreve.com/register

Any help would be greatly appreciated!


.htaccess causing weird redirect issues? - El Forum - 09-21-2010

[eluser]n0xie[/eluser]
Try this:
Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    #Removes access to the system folder by users.
    #Additionally this will allow you to create a System.php controller,
    #previously this would not have been possible.
    #'system' can be replaced if you have renamed your system folder.
    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php/$1 [L]

    #Checks to see if the user is attempting to access a valid file,
    #such as an image or css document, if this isn't true it sends the
    #request to index.php
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

And set the URI_Protocol in your config.php to PATH_INFO


.htaccess causing weird redirect issues? - El Forum - 09-21-2010

[eluser]Corey Freeman[/eluser]
That causes an internal server error...

http://www.cloudreve.com/


.htaccess causing weird redirect issues? - El Forum - 09-21-2010

[eluser]n0xie[/eluser]
Are you running on FastCGI? Else you might want to take a look at : http://ellislab.com/forums/viewthread/159406/


.htaccess causing weird redirect issues? - El Forum - 09-21-2010

[eluser]Corey Freeman[/eluser]
[quote author="n0xie" date="1285095969"]Are you running on FastCGI? Else you might want to take a look at : http://ellislab.com/forums/viewthread/159406/[/quote]

The other configuration also gives me an internal server error. I -know- I had something working .htaccess on this exact website before but maybe downgrading my host recently to VPS changed things? Now nothing is working >.<


.htaccess causing weird redirect issues? - El Forum - 09-21-2010

[eluser]n0xie[/eluser]
Are you sure mod_rewrite is enabled on your server? To make sure create an info file in your webroot and look for 'mod_rewrite'
Code:
&lt;?php
// info.php
phpinfo();
?&gt;



.htaccess causing weird redirect issues? - El Forum - 09-21-2010

[eluser]Corey Freeman[/eluser]
I don't see any field that says "mod_rewrite"


.htaccess causing weird redirect issues? - El Forum - 09-28-2010

[eluser]n0xie[/eluser]
Maybe this will help: http://ellislab.com/forums/viewthread/96347/


.htaccess causing weird redirect issues? - El Forum - 09-28-2010

[eluser]bretticus[/eluser]
[quote author="Corey Freeman" date="1285097426"]I don't see any field that says "mod_rewrite"[/quote]

I believe you have already don this part, but to reiterate...

Create an info.php file in your site root (same level as the main index.php) Put one line of code in it (as Noxie recommended.)

Code:
&lt;?php
// info.php
phpinfo();
?&gt;

In the output look for apache2handler (yours might be different because we all assume FastCGI.) If you do have that section, look for "Loaded Modules." If you have that subsection and no mod_rewrite, that you cannot hide index.php.

If you get

Server API CGI

from about the 3rd line down, you have CGI and the apache2handler instructions are irrelevant. Do you have SSH access by chance? If so you might be able to use apache2ctl -M (or apachectl -M) and look for "rewrite_module."

If problems persist, contact the administrators.


.htaccess causing weird redirect issues? - El Forum - 10-01-2010

[eluser]Corey Freeman[/eluser]
I got this working but for some reason it won't link to local images...

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

Any ideas?