H,
I'm using codeigniter hmvc framework.i don't know how to configure this fo subdomain. i've installed it but not working. any help please.
project/
application/
controller/installer
modules/
default controller is pointed to installer.php
$route[default_controller] = 'installer';
but unable access the controller.
No matter it is hosted in subdomain or main domain. You need to do couple of things to make it workable.
Step one
Config base_url in config.php as follows:
$config['base_url'] = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? "https" : "http");
$config['base_url'] .= "://".$_SERVER['HTTP_HOST'];
$config['base_url'] .= str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']);
Step two Check your .htaccess. It should looks like as bellows:
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
Note: .htaccess vary depending on server. In some server (e.g.: Godaddy) need to use the following .htaccess:
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
Hope it will help you.
find this file
application/config/config.php
edit here thats all
$config['base_url'] = "http://subdomain.example.com/";
Related
i want to removing index.php in hmvc code igniter , when i type the url without index.php it's running well but when i process to other controller the url is automatically showing index.php after my codeigniter folder.
example i type :
localhost/ci_hmvc/user/login
and the result when i process to other controller is :
localhost/ci_hmvc/index.php/user/dashboard
and my .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /ci_hmvc/index.php/$1 [L]
</IfModule>
please any one help me
You can make changes in config.php which is in config folder
You can see the line
$config['index_page'] = 'index.php';
Change this line in to
$config['index_page'] = '';
I hope this will helps you
put this code in .htaccess and place the htaccess file to the root of the folder..
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php?/$1 [L,QSA]
I am new in codeigniter and I love to use it in my future projects too.
I having a big time problem to make my url user friendly.
I have a website running that has a lot of pages, so URLs get too big and they look too bad.
So what I want to do, is shorten my URLs. For example:
www.abc.com/index.php/main/home
I want to make something like this:
www.abc.com/home
So my question is, How should I do this thing in CodeIgniter 2.2.3 ? Is there any demo?
I was see so many links for it but it can not full fill my requirement so please help me..
You can use routes for this purpose
To remove index.php use .htaccess with following code
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
and in config.php
$config['uri_protocol'] = 'AUTO';
now in your routes application/config/routes.php
$route['home']='main/home';
To remove index.php, place .htaccess outside application folder (root)
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
To short URL, use config/routes.php
$route['home'] = "main/home";
Ex:
To use this I'm Moving
Firstly i create .htaccess file and put this code in it..
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /xyz.co/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
than go to application/config/routes.php and put below code.
$default_controller = "auth";
$controller_exceptions = array('main');
$route['default_controller'] = $default_controller;
$route["^((?!\b".implode('\b|\b', $controller_exceptions)."\b).*)$"] = $default_controller.'/$1';
$route['404_override'] = 'error';
$route['translate_uri_dashes'] = FALSE;
and in config.php
$config['uri_protocol'] = 'AUTO';
thats all...
How to remove domainname.com/index.php/photos from the pyrocms URL. I tried to remove index.php from $config['index_page'] = 'index.php';. But it does not work. Can anyone help please. Is there anything i have to do during the installation time.?
You will have to use an .htaccess file in the root folder too (if you are using apache or php built-in webserver).
Here is the one I use: https://gist.github.com/taiar/2424263
Here is the reference from the oficial docs: https://ellislab.com/codeigniter/user-guide/general/urls.html
You need to write a .htaccess rule
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
MySite in my PC is http://localhost:8080/MySite/MyController
when I deploy to hosting server, I can only access
http://subdomain.MyDomain.com/MySite/MyController but not http://subdomain.MyDomain.com/MySite/MyController/AnyFunction (it gave 404 error)
I have created .htaccess to remove index.php, it works fine in my PC;
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
I also set $config['uri_protocol'] = 'REQUEST_URI';
Local setting:
$config['base_url']='http://localhost:8080/MySite/';
$config['index_page'] = '';
Hosting setting:
$config['base_url']='http://subdomain.MyDomain.com/MySite/';
$config['index_page'] = '';
Can anyone advice where have I gone wrong?
TIA.
Maybe you need to add a question mark to your rewrite rule:
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
source: http://codeigniter.com/forums/viewthread/181440/#862893
Hi everyone I'm having some problems when removing index.php in CodeIgniter.
I created my application locally and it works fine but when I uploaded it, removing index.php doesn't seem to work.
I have a feeling this could have something to do with my host, it's not the best and I've had problems before. It's hosted on Fatcow.
So..
all my CodeIgniter files are located in a sub-dirctory called outfitr. e.g
<root>/outfitr/
I have my .htaccess file located in this folder with the following taken from the CI wiki:
EDITED
RewriteEngine On
RewriteBase /outfitr/
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
changes fo my config.php look like the following. I have enabled query strings as I need them for a section of my application.
$config['base_url'] = "<host>.com/outfitr/";
$config['index_page'] = "";
...
$config['uri_protocol'] = "PATH_INFO";
$config['enable_query_strings'] = TRUE;
Any help would be great. As I said I think it might have something to do with the host Fatcow.
I have tested mod_rewrite, following the steps on the following page and it seems to be enabled.
http://www.wallpaperama.com/forums/how-to-test-check-if-mod-rewrite-is-enabled-t40.html
ok so after some trial and error I finally got it working. I setup my .htaccess file as follows. Note the '?' in RewriteRule.
RewriteEngine On
RewriteBase /outfitr/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1 [L]
Then in config.php I set
$config['uri_protocol'] = 'REQUEST_URI';
Think this is down to the way some hosts setup their mod_rewrite module. Dreamhost and hostgator have the same problem.
http://codeigniter.com/wiki/mod_rewrite/
If your installation is not in the server root you will need to amend the RewriteBase line from “RewriteBase /” to “RewriteBase /folder/”
The current .htaccess you have is re-routing all requests to /index.php, which as you said yourself is not there. You want them to route to /outfitr/index.php.
You can do this by changing the RewriteBase /outfitr/
If not, please give more detail.