Welcome Guest, Not a member yet? Register   Sign In
.htaccess trouble
#1

[eluser]dennismonsewicz[/eluser]
In my htaccess file I am stripping out not only the index.php from the URL but I am also stripping out another piece of the URL to make everything work as it should. I have introduced a folder inside of my controller directory and with the way my htaccess file is setup, I cannot access those files in that directory.

Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

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

<IfModule !mod_rewrite.c>
    # If we don't have mod_rewrite installed, all 404's
    # can be sent to index.php, and everything works as normal.
    # Submitted by: ElliotHaughin

    ErrorDocument 404 /index.php
</IfModule>

I have no idea how to tell my htaccess file to read out of the admin folder... any ideas?
#2

[eluser]Sean Gates[/eluser]
You need to check for a directory name as well using !-d in the RewriteCond. Like so:

Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

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

<IfModule !mod_rewrite.c>
    # If we don't have mod_rewrite installed, all 404's
    # can be sent to index.php, and everything works as normal.
    # Submitted by: ElliotHaughin

    ErrorDocument 404 /index.php
</IfModule>
#3

[eluser]dennismonsewicz[/eluser]
When I do your suggestion I receive a 500 internal server error
#4

[eluser]Sean Gates[/eluser]
Try:
Code:
RewriteCond %{REQUEST_FILENAME} !-fd

... and let me know. -d is the identifier for a directory. Per this document: http://httpd.apache.org/docs/1.3/mod/mod...ewriteCond
#5

[eluser]Sean Gates[/eluser]
Actually, try:

Code:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !-d
#6

[eluser]InsiteFX[/eluser]
If your running on Windows localhost you need to change the
.htaccess file from this.

Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

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

<IfModule !mod_rewrite.c>
    # If we don't have mod_rewrite installed, all 404's
    # can be sent to index.php, and everything works as normal.
    # Submitted by: ElliotHaughin

    ErrorDocument 404 /index.php
</IfModule>

To this:

Code:
<IfModule mod_rewrite.so>
    RewriteEngine On
    RewriteBase /

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

<IfModule !mod_rewrite.so>
    # If we don't have mod_rewrite installed, all 404's
    # can be sent to index.php, and everything works as normal.
    # Submitted by: ElliotHaughin

    ErrorDocument 404 /index.php
</IfModule>

Notice the change from .c to .so.

InsiteFX
#7

[eluser]dennismonsewicz[/eluser]
[quote author="Sean Gates" date="1270697733"]Actually, try:

Code:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !-d
[/quote]

Ok... so if I go to: http://myurl.dev/admin/authorize (.dev is my virtual host address) I get a 404 CI error... but if I go to: http://myurl.dev/index.php?/admin/authorize everything works like it should...

Any thoughts there?

Updated .htaccess file

Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    #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_URI} !-d
    RewriteRule ^(.*)$ index.php?/welcome/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
    # If we don't have mod_rewrite installed, all 404's
    # can be sent to index.php, and everything works as normal.
    # Submitted by: ElliotHaughin

    ErrorDocument 404 /index.php
</IfModule>
#8

[eluser]dennismonsewicz[/eluser]
bump
#9

[eluser]dennismonsewicz[/eluser]
Any help with this?
#10

[eluser]danmontgomery[/eluser]
Have you tried changing the value of $config['uri_protocol'] in config.php?




Theme © iAndrew 2016 - Forum software by © MyBB