codefight cms could not get admin page

This Forum Is To Discuss About Installation Problems And Solutions
chaleswa
Member Neptune
Member Neptune
Posts: 9
Joined: Thu Apr 01, 2010 5:57 pm
antispam: NO

codefight cms could not get admin page

Post by chaleswa » Thu Apr 01, 2010 6:11 pm

Hi,
I am using codefight cms in the development server (e.g http://www.myhost.com/dev/) , which is set up on a godaddy server.
First I couldn't access any CMS pages. Then I searched and found out that the .htaccess needed to be changed to make it work.

I changed the following htaccess lines
RewriteBase /
RewriteRule ^admin/(.*)$ admin.php/$1 [L]
RewriteRule ^(.*)$ index.php/$1 [L]

to this. [below changed lines]
RewriteBase /dev
RewriteRule ^admin/(.*)$ admin.php?/$1 [L]
RewriteRule ^(.*)$ index.php?/$1 [L]

now, when I try to access the http://www.myhost.com/dev/admin, I get a 404 page.
Is there any way that I could be able to resolve this by making any changes to the .htaccess?

Thank you

dbashyal
Site Admin
Posts: 30
Joined: Mon May 21, 2007 10:35 pm
antispam: NO
Contact:

Re: codefight cms could not get admin page

Post by dbashyal » Thu Apr 01, 2010 7:48 pm

chaleswa wrote:Hi,
I am using codefight cms in the development server (e.g http://www.myhost.com/dev/) , which is set up on a godaddy server.
First I couldn't access any CMS pages. Then I searched and found out that the .htaccess needed to be changed to make it work.

I changed the following htaccess lines
RewriteBase /
RewriteRule ^admin/(.*)$ admin.php/$1 [L]
RewriteRule ^(.*)$ index.php/$1 [L]

to this. [below changed lines]
RewriteBase /dev
RewriteRule ^admin/(.*)$ admin.php?/$1 [L]
RewriteRule ^(.*)$ index.php?/$1 [L]

now, when I try to access the http://www.myhost.com/dev/admin, I get a 404 page.
Is there any way that I could be able to resolve this by making any changes to the .htaccess?

Thank you
Hi Chaleswa,

You seems to be doing everything right. I was unable to access the /dev. Did you remove it or is still not accessible.

RewriteBase is not really required, so you can try removing that.

If that doesn't work and if you trust you can PM me your temporary FTP access and i can look it for you.

chaleswa
Member Neptune
Member Neptune
Posts: 9
Joined: Thu Apr 01, 2010 5:57 pm
antispam: NO

Re: codefight cms could not get admin page

Post by chaleswa » Thu Apr 01, 2010 9:56 pm

After removing the rewrite base it didn't work. pls check your pm for details.

chaleswa
Member Neptune
Member Neptune
Posts: 9
Joined: Thu Apr 01, 2010 5:57 pm
antispam: NO

Re: codefight cms could not get admin page

Post by chaleswa » Thu Apr 01, 2010 11:55 pm

I think I got it fixed (not sure whether it's the right fix). But it worked for me.
I found that the URI segment was combining the suffix (.HTML) with the last argument

e.g
http://www.myhost.com/user/register.html
it is considered as
http://www.myhost.com/user/register_html

I modified the URI.php library file to remove the suffix and then it started working.
Now everything did work fine.

The actual modification I made was to

Code: Select all

function _explode_segments()
	{
		foreach(explode("/", preg_replace("|/*(.+?)/*$|", "\\1", $this->uri_string)) as $val)
		{
			// Filter segments for security
			$val = trim($this->_filter_uri($val));

			if ($val != '')
			{
				$this->segments[] = $val;
			}
		}
	}
to this

Code: Select all

function _explode_segments()
	{
		foreach(explode("/", preg_replace("|/*(.+?)/*$|", "\\1", $this->uri_string)) as $val)
		{
			// Filter segments for security
			$val = trim($this->_filter_uri($val));

			if ($val != '')
			{
				$this->segments[] = $val;
			}
		}
		
		/* START:  Non CI code to solve the  problem of suffix combining with the last argument */
		if ($this->config->item('url_suffix') != '') {
			$index = sizeof($this->segments);
			$index -= 1;
			$url_suffix = str_replace(".","_",$this->config->item('url_suffix'));
			if (substr($this->segments[$index],(strlen($this->segments[$index]) - strlen($url_suffix)),strlen($url_suffix)) == $url_suffix) {
				$this->segments[$index] = substr($this->segments[$index],0,(strlen($this->segments[$index]) - strlen($url_suffix)));
			}
		}
		/* END:  Non CI code to solve the  problem of suffix combining with the last argument */
	}
Please let me know if this is the right solution or is there a proper solution to it. Thank you very much for your help!

Chaleswa

dbashyal
Site Admin
Posts: 30
Joined: Mon May 21, 2007 10:35 pm
antispam: NO
Contact:

Re: codefight cms could not get admin page

Post by dbashyal » Fri Apr 02, 2010 12:04 am

chaleswa wrote:After removing the rewrite base it didn't work. pls check your pm for details.
Hi Chaleswa,

Its strange that htaccess works for frontend but not for admin. I did few searches and found godaddy has issues with its .htaccess and so many people frustrated with that.

Now the only thing to make admin accessible is to use 'admin.php?' in admin config and removing 'admin/' occurence in all view files under 'app\admin\modules'. You can do a quick search and replace.

see: http://codeigniter.com/forums/viewthread/71881/#625476

dbashyal
Site Admin
Posts: 30
Joined: Mon May 21, 2007 10:35 pm
antispam: NO
Contact:

Re: codefight cms could not get admin page

Post by dbashyal » Fri Apr 02, 2010 12:13 am

chaleswa wrote:I think I got it fixed (not sure whether it's the right fix). But it worked for me.
I found that the URI segment was combining the suffix (.HTML) with the last argument

e.g
http://www.myhost.com/user/register.html
it is considered as
http://www.myhost.com/user/register_html

I modified the URI.php library file to remove the suffix and then it started working.
Now everything did work fine.

Please let me know if this is the right solution or is there a proper solution to it. Thank you very much for your help!

Chaleswa
If you don't need suffix, you can just set in config:
app\frontend\config\config.php
app\admin\config\config.php

Code: Select all

$config['url_suffix'] = ""; //leave this blank. By default codefight cms has .html but as it was causing issue, i have removed that for you.
Its more than 1am here in sydney so i am off to sleep now. I'll have a look at this thread tomorrow. Please keep me update. Thanks and good night.

chaleswa
Member Neptune
Member Neptune
Posts: 9
Joined: Thu Apr 01, 2010 5:57 pm
antispam: NO

Re: codefight cms could not get admin page

Post by chaleswa » Fri Apr 02, 2010 12:52 am

Hi dbashyal,
Actually I did put you in a wrong impression by this
I modified the URI.php library file to remove the suffix and then it started working.
when I accessed the last segment using

Code: Select all

$this->uri->segment(no)
it said for e.g login_html instead of login.
So, I was actually trying to remove the suffix from the last segment value (not from the URL) .
Thus allowing the url suffix to work and removing the suffix from the last segment value.

For admin, I think what you had detailed is the only Hope for now.

dbashyal
Site Admin
Posts: 30
Joined: Mon May 21, 2007 10:35 pm
antispam: NO
Contact:

Re: codefight cms could not get admin page

Post by dbashyal » Fri Apr 02, 2010 9:07 am

chaleswa wrote:Hi dbashyal,
Actually I did put you in a wrong impression by this
I modified the URI.php library file to remove the suffix and then it started working.
Hi Chaleswa,

Yes i missunderstood you. And, i think your solution is best for now and actually i added that to my site codefight.org now as well. Thanks :)

I saw that issue after upgrading to current codeigniter and not sure how i fixed that time. Hopefully it will be fine in next release of codeigniter.

chaleswa
Member Neptune
Member Neptune
Posts: 9
Joined: Thu Apr 01, 2010 5:57 pm
antispam: NO

Re: codefight cms could not get admin page

Post by chaleswa » Fri Apr 02, 2010 5:07 pm

Hi dbashyal ,
Yes i missunderstood you. And, i think your solution is best for now and actually i added that to my site codefight.org now as well. Thanks :)
I am happy that it was useful.

And I went ahead with your solution of removing "admin/" for the admin section.
I added "admin.php?" in the admin/config/config.php file

Code: Select all

$config['index_page'] = "admin.php?";
and removed the "admin/" within
admin/modules
admin/views/ and also
admin/libraries/login.php

It Worked a Treat.

Thank you very much for the timely solution!

dbashyal
Site Admin
Posts: 30
Joined: Mon May 21, 2007 10:35 pm
antispam: NO
Contact:

Re: codefight cms could not get admin page

Post by dbashyal » Tue Apr 20, 2010 9:29 pm

New version of codefight cms is now available for download. Just a new skin + few bug fixes + removed "admin/" from url to work in above server environment as well.

Locked

Who is online

Users browsing this forum: No registered users and 2 guests