my host account is something like:
~
~/public_html
~/public_html/system/application
to access my web, I need to put http://example.com/~userid in address bar
I install codeigniter in the ~/public_html directory, I can access http://example.com/~userid.
The Welcome page shows correctly, and the related user guide pages show correctly.
The problem is: if I create a new controller, and create new views, the web page just show "Error 404: Document Not Found". If I use http://example.com/~userid/welcome/index it has the same problem.
If I use base_url() function it shows http://example.com/~userid/
What should I do do fix this problem?
Thanks in advance!
Try http://example.com/~userid/index.php/welcome/index.
It looks like your URL rewriting is not set up or badly configured. This is the default way if URL rewriting is disabled.
EDIT See this page of the user guide, especially the section "Removing the index.php file" on how to set up URL rewriting.
Related
I am new to Codeigniter and I have recently started a project using Codeigniter v3.10 and the Ion-Auth library for user actions.
When I try to access the login page base_url/auth/login I get a 404 error.How can I troublehsoot/solve this? I don't see anything in my network tab in the browser.
I copied and configured the files as presented in user docs.
Thank you in advance
base_url/index.php/auth/login
or use .htaccess to remove index.php
In my main domain I have created a sub domain where I have uploaded my files of ZF2 but it it not allowing me to access the home page.
If I type <submdomainname>.<domainname>.com it is saying that:
Forbidden:
You don't have permission to access / on this server.
Additionally:
a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Sounds indeed like a server configuration issue.
Try once to put a simle index.php in your folder and see if you can open it:
index.php:
<?php
echo("Hello world");
And add it to your public folder and try to browse to it:
http://www.example.com/public/index.php
If that doesn't work, then you know at least that it is not related to ZF2.
After you tried this you can come back with more details on your problem.
You should add reading permission to the folder where you host your subdomain.
I have an issue making my cakephp project work on my shared hosting server.
I followed all the needed steps so it can work on local, and it's working. Once I upload on the server, in a specific domain name, only the homepage works, once I want to call another controller, i get the "404 - File or directory not found." error.
the project is hosted at : fme.tahrijouti.com. the domain redirects to the webroot folder in the cakephp structure.
My controller is : posts. I can make it work if I change the URL by specifying the controller & action, you can see it here.
I have checked and the rewrite module is on.
Can you please help me with that ?
Please have a look on CakePHP default routing. And don't forget to fix all your links.
Your links should have proper addresses. Just look on your Posts's link. These are like this http://fme.tahrijouti.com/index.php/posts/posts/view/2 but it should be http://fme.tahrijouti.com/index.php/posts/view/2. Remember after your host name there exist controller then a function of that controller then argument of that function like this: [host]/[controller]/[function]/[argument1]/[argument2]. Hope it helps. I think you can read cookbook another bit as most things are clear there from my experience.
As I don't have your codes of controller I cannot say more.
I am using hmvc for creating a register page :-
In the url now I am typing :- http://localhost/CI/index.php/user/registration
user is the module name
controller :- registration.php
<?php
class Registration extends MX_Controller{
function index() {
$this->load->view('homepage');
}
function register(){
$this->load->view('registrationPage');
}
}
?>
view :- homepage.php
<html>
<body>
register
</body>
</html>
the problem is that in my url i have to type http://localhost/CI/index.php/user/registration/register for coming to registration page.
I want http://localhost/CI/index.php/user/register how can we do this.?
setting base_url is not working and setting routes ia also not working.
Is this possible to go to any page without giving module name in the url..?
Edit you routes.php file under config folder
$route['user/register'] = 'user/registration/register';
You could use url rewrite in .htaccess file
See url rewriting without htaccess
and how to do url-rewriting in PHP
In CodeIgniter, .htaccess is present in
system/application/config/config.php
Get more info here as I am not aware of CodeIgniter
You should create a proper URL for your site by adding an entry in your host file. For example:
127.0.0.1 http://mysitename
or
127.0.0.1 http://localhost.mysitename
Google up how to set a virtual host in apache. You should be able to find plenty of articles about that. Now edit your apache config to enable virtual hosts. With this feature enabled you will create a virtual host entry for your site. The virtual host tells apache to map the URL you've chosen to the specific directory path of your project files. (This way the actual directory path is not part of your URL.)
Next you should edit your .htaccess so that requests are always routed through the index.php front controller. Once this is done you will not have to use '/index.php/' as part of each URL. Read the section in the Code Igniter user guide called Code Igniter URLs. It has sample .htaccess configurations. Moreover, it explains how Code Igniter URLs work.
In order for CI to work with the virtual host, you must set the base URL in your CI config file to match the v-host URL.
Once you've completed all of this, you will need to restart apache.
Now you can just name your controllers and methods in accordance with the URL structure you want. In this case, a controller called user.php with a method called register.
Is it a must to use HMVC in your project? Otherwise go for simple Codeigniter way because that is what you expect in this situation.
I have generated the Backend Application for the Symfony(1.4 and ORM Propel) project, in my Production env. But on calling the URL as http://www.mydomain.com/backend.php it is showing 404. Is there any config error or something like that..
Look inside your web folder and make sure that backend.php actually exists there, it might have been named something else [typo maybe]. Does mydomain.com work ?
Update
Disable/rename your .htaccess file temporarily and see if this fixes it. It looks like mod_rewrite is catching "backend.php" and passing it on as a module name.
The Problem was due to the Permission of the file i.e backend.php. I have changed the Owner/Group permission and the backend app started working. If any one had this kind of a problem, please check the file permissions, might help!
For rendering 404 page, the third parameter in your front controller must be false.
Like this:
ProjectConfiguration::getApplicationConfiguration('backend', 'dev', false);