Welcome Guest, Not a member yet? Register   Sign In
URL Problem when without slash
#1

[eluser]reaktivo[/eluser]
Hi all, I have a problem when trying to access the CI root ... the url is: http://grupofema.com/admin/ , where admin is the codeigniter folder, so the problem is that when i try to access it using http://grupofema.com/admin (without the last slash) it gives me a
Quote:Bad Request. Your browser sent a request that this server could not understand.
message, my .htaccess is as follows:

Code:
SecFilterEngine Off
SecFilterScanPOST Off
RewriteEngine On
RewriteCond $1 !^(index\.php|images|imgs|js|css|files)
RewriteRule ^(.+)$ index.php?$1 [L]

(i need the secfilter's off so i can upload files)...
thanks for any help.
#2

[eluser]Craig A Rodway[/eluser]
Try this:

Code:
SecFilterEngine Off
SecFilterScanPOST Off
RewriteEngine On
RewriteBase /admin/
RewriteCond $1 !^(index\.php|images|imgs|js|css|files)
RewriteRule ^(.*)$ index.php/$1 [L]
#3

[eluser]lifewithryan[/eluser]
you might want to try adding the RewriteBase...

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

Not sure if that will do anything or not, been a while since I messed with Apache rules...

EDIT: Looks like someone beat me to it Smile
#4

[eluser]reaktivo[/eluser]
Thanks, tried both and neither worked, the first one (from Craig) when i access with '/admin' it returns a 404 not found, and when i access with '/admin/' i get a Bad Request Message... the one from lifewithryan, made that when i access with '/admin/' or '/admin', both give me a 404 not found message ...

thank you for the quick responses anyway, i'm a htaccess newb... heh, hope you guys make some sense from this...

sorry for my english.
#5

[eluser]lifewithryan[/eluser]
so do you have a controller called admin.php?

is your htaccess file called ".htaccess" (notice the dot)

Is your apache configuration setup to allow the use of .htaccess files?
#6

[eluser]reaktivo[/eluser]
[quote author="lifewithryan" date="1201763075"]so do you have a controller called admin.php?[/quote]
no, i think you misunderstood me, 'admin' is my codeigniter folder so my folder hierarchy is like this:

Code:
www.grupofema.com
  -admin
      -.htaccess
      -index.php
      -system
        -application
        -cache
        -codeigniter
        -...


[quote author="lifewithryan" date="1201763075"]is your htaccess file called ".htaccess" (notice the dot)[/quote]
yes, and it is positioned like above.

[quote author="lifewithryan" date="1201763075"]Is your apache configuration setup to allow the use of .htaccess files?[/quote]

yes Smile
#7

[eluser]lifewithryan[/eluser]
Strange...the solution from Craig should have worked.

Perhaps the RewriteCondition needs to read:

Code:
RewriteCond ^/admin/$1 !^(index\.php|images|js|css|robots\.txt)

and perhaps a second one like: thought I don't think you'd need this if you always reference something after the /admin...e.g /admin/user

Code:
RewriteCond ^/admin$1 !^(index\.php|images|js|css|robots\.txt)
#8

[eluser]reaktivo[/eluser]
Hi, i'm still dealing with this, any help is appreciated, so.. I contacted my hosting support, although I'm not sure if its a hosting problem, anyway, they could'nt find out what was causing the strange behavior, but the recommended I try out this htaccess:

RewriteEngine On
RewriteBase /admin/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /admin/index.php [L]

it now redirects to the places it should, I mean it doesn't give me any more Bad Request messages, but it says it gets in a redirection loop, do you think this is causes by the way the htaccess is constructed ? or by any other thing?
#9

[eluser]reaktivo[/eluser]
I also tryed this one:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.php?$1 [L]

but now my internal routes don't work


EDIT: IT DOES WORK!

sorry if i wasted your time, but i was desperate, thanks all




Theme © iAndrew 2016 - Forum software by © MyBB