user3833682
user3833682

Reputation: 263

404 Not Found in yii framework

I'm new user of yii framework. I've got project and its name is crm now when I try to run it, it gives me the error of 404 Not Found and below of it shows The requested URL /crm/web/index.php was not found on this server., now when I go to my root index.php it has following line <?php header('Location: /crm/web/index.php'); ?> and when I just go into web/index.php it has a lot of code now the problem is it can't access/find the index.php in web directory I also tried and create another file testing.php and change <?php header('Location: /livecrm/web/index.php'); ?> to <?php header('Location: /livecrm/web/testing.php'); ?> but it didn't work for me I already set the Environment Variables, so now what to do.

enter image description here

Thanks in advanced

Upvotes: 1

Views: 4685

Answers (2)

ScaisEdge
ScaisEdge

Reputation: 133400

You are using Yii2 and have several application inside your project .. from your explorer i see

your project is named livecrm

inside you have thiese application dir

  • frontend
  • livecrm
  • liveCRMV2.2
  • livefactory

and other

then what you named "I've got project and its name is crm" is not present

but done your app dir structure if you want execute a webapp inside your project you should use (eg for webapp frontend)

livecrm/frontend/web/index.php

or for livecrm

livecrm/livecrm/web/index.php 

Upvotes: 1

Ravi Hirani
Ravi Hirani

Reputation: 6539

Make sure there is index.php file in path crm/web/index.php

Put this line to your root index.php file.

instead of your header location:

<?php
$host  = $_SERVER['HTTP_HOST'];
$uri   = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
$extra = '/web/index.php';
header("Location: http://$host$uri/$extra");
?>

and also check your .htaccess file.

It should be:-

Options -Multiviews
Options +FollowSymLinks
RewriteEngine on
RewriteBase /crm/

# if a directory or a file exists, use it directly

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# otherwise forward it to index.php
RewriteRule . web/index.php

Upvotes: 0

Related Questions