Welcome Guest, Not a member yet? Register   Sign In
Problem with redirect on server after .htaccess rule.
#1

[eluser]Solarpitch[/eluser]
Hey Guys,

first post. I've read many posts on this topic and tried many solutions but there's noting that works for my specific problem.

After my host added the .htaccess rule, every time I try to access a page in the application it will redirect to the main index.php file on the server.

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

For example, I'm developing the app in a directory (enterprise/) on the server..

http://mysite.com/enterprise/

if I call...

http://mysite.com/enterprise/index.php/{controller_name}/login
or
http://mysite.com/enterprise/{controller_name}/login

The URL will stay the same but will display the contents of www.mysite.com/index.php

Code:
//settings...

$config['base_url'] = "http://mysite.com/enterprise/";
$config['index_page'] = "index.php";

I want to achieve the URI without the index.php being displayed...

http://mysite.com/enterprise/{controller_name}/login
#2

[eluser]Phil Sturgeon[/eluser]
Did this work before the htaccess rule, as it sounds to me like a problem with your chosen URI protocol. Try switching it to PATH_INFO or REQUEST_URI.
#3

[eluser]Solarpitch[/eluser]
Before the rule this worked fine..

http://mysite.com/enterprise/index.php/{...ame}/login

I added a new rule there that was recommended on a different forum, but the problem seems to be the same. I modified the URI Protocol to what you suggested but no joy. At the moment with the rule...

http://mysite.com/enterprise/index.php/{...ame}/login -> Works

http://mysite.com/enterprise/index.php/{...ame}/login -> When I click on submit to login, it will reload the page and change the uri to http:mysite.com/enterprise/form while loading contents of mysite.com/index.php

http://mysite.com/enterprise/{controller_name}/login -> Loads contents of mysite.com/index.php

The account server is Linux based also.
#4

[eluser]Solarpitch[/eluser]
Just bumping this.

Current status is that, if I go to..

http://mysite.com/enterprise/index.php/login/form ... this works fine, however if I try...

http://mysite.com/enterprise/login/form .. it will load the contents of mysite.com/index.php into the page, which doesnt make sense.

Because the framework is in the enterprise directory on the server.

Undecided
#5

[eluser]Pascal Kriete[/eluser]
Try removing the leading slash in the RewriteRule:
Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]
#6

[eluser]Solarpitch[/eluser]
Thanks for your reply. Will try that tomorrow. I dont have access to my .htaccess file so will need to get the host to try it.




Theme © iAndrew 2016 - Forum software by © MyBB