Yii Framework Forum: How to set backend.php as a default page instead of index.php - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

How to set backend.php as a default page instead of index.php For admin: How to set backend.php as a default page Rate Topic: ***** 1 Votes

Poll: For admin: How to set backend.php page as default page? (0 member(s) have cast votes)

Is it possible to backend.php set as default index page ?

  1. Yes (0 votes [0.00%])

    Percentage of vote: 0.00%

  2. No (0 votes [0.00%])

    Percentage of vote: 0.00%

  3. May Be (0 votes [0.00%])

    Percentage of vote: 0.00%

Vote Guests cannot vote

#1 User is offline   Chinmay Sahu 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 9
  • Joined: 30-March 17

Posted 07 December 2017 - 06:00 AM

I have successfully separate frontend and backend. But I am unable to set this in virtual host. Please check:


Backend virtual host:

<VirtualHost *:80>
    DocumentRoot "C:\xampp\htdocs\myproject"
    ServerName admin.chinmay.com
  <Directory "C:\xampp\htdocs\myproject">
    AllowOverride All
    Order allow,deny
    Allow from all

    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . backend.php
    DirectoryIndex backend.php
    Require all granted

  </Directory>
</VirtualHost>



Frontend virtual host:


<VirtualHost *:80>
    DocumentRoot "C:\xampp\htdocs\myproject"
    ServerName demo.chinmay.com
  <Directory "C:\xampp\htdocs\myproject">
    AllowOverride All
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>


See above code my `backend.php` file which is not working for inner pages.
**admin.chinmay.com** this is working fine but when I call other controller action I got `index.php` instead of `backend.php`

I want all the action and sub-action which comes under `admin.chinmay.com` should load `backend.php` file.

How to manage it?

Please help.
Chinmay Sahu
Senior Software Engineer
Muvi - Launch your video platform in 1-Click
www.muvi.com
Phone: +91 904 0214 490 | Email: chinmay@muvi.com | Skype: live:chinmay.muvi
Recognized as “Enterprise OTT” platform of the year by FierceOnlineVideo
0

#2 User is offline   softark 

  • Keep It Simple
  • Yii
  • Group: Moderators
  • Posts: 3,411
  • Joined: 16-February 11
  • Location:Japan

Posted 07 December 2017 - 06:26 AM

Hmm, I don't understand why you have to share the DocumentRoot for both "admin.chinmay.com" and "demo.chinmay.com".
0

#3 User is offline   Chinmay Sahu 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 9
  • Joined: 30-March 17

Posted 07 December 2017 - 07:19 AM

View Postsoftark, on 07 December 2017 - 06:26 AM, said:

Hmm, I don't understand why you have to share the DocumentRoot for both "admin.chinmay.com" and "demo.chinmay.com".


I have setup vhost but exactly don't know how to do that. I searched and got this way.
Chinmay Sahu
Senior Software Engineer
Muvi - Launch your video platform in 1-Click
www.muvi.com
Phone: +91 904 0214 490 | Email: chinmay@muvi.com | Skype: live:chinmay.muvi
Recognized as “Enterprise OTT” platform of the year by FierceOnlineVideo
0

#4 User is offline   softark 

  • Keep It Simple
  • Yii
  • Group: Moderators
  • Posts: 3,411
  • Joined: 16-February 11
  • Location:Japan

Posted 07 December 2017 - 08:02 AM

I would keep the things simple.

Assuming you have installed the advanced application template to "C:\xamp\htdocs\myproject" ...

Backend virtual host:
<VirtualHost *:80>
    DocumentRoot "C:\xampp\htdocs\myproject\backend\web"
    ServerName admin.chinmay.com
  <Directory "C:\xampp\htdocs\myproject\backend\web">
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . index.php
    ...
  </Directory>
</VirtualHost>

Frontend virtual host:
<VirtualHost *:80>
    DocumentRoot "C:\xampp\htdocs\myproject\frontend\web"
    ServerName demo.chinmay.com
  <Directory "C:\xampp\htdocs\myproject\frontend\web">
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . index.php
    ...
  </Directory>
</VirtualHost>

0

#5 User is offline   softark 

  • Keep It Simple
  • Yii
  • Group: Moderators
  • Posts: 3,411
  • Joined: 16-February 11
  • Location:Japan

Posted 07 December 2017 - 09:22 AM

/* Moved from "2.0" to "1.x", since @Chinmay is working with Yii 1.x */
0

#6 User is offline   Chinmay Sahu 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 9
  • Joined: 30-March 17

Posted 08 December 2017 - 04:25 AM

View Postsoftark, on 07 December 2017 - 09:22 AM, said:

/* Moved from "2.0" to "1.x", since @Chinmay is working with Yii 1.x */

Thanks @softark
I am still waiting for your expert reply.
Chinmay Sahu
Senior Software Engineer
Muvi - Launch your video platform in 1-Click
www.muvi.com
Phone: +91 904 0214 490 | Email: chinmay@muvi.com | Skype: live:chinmay.muvi
Recognized as “Enterprise OTT” platform of the year by FierceOnlineVideo
0

#7 User is offline   softark 

  • Keep It Simple
  • Yii
  • Group: Moderators
  • Posts: 3,411
  • Joined: 16-February 11
  • Location:Japan

Posted 08 December 2017 - 10:37 AM

View PostChinmay Sahu, on 08 December 2017 - 04:25 AM, said:

Thanks @softark
I am still waiting for your expert reply.


I'm sorry, Chinmay, but I have no experience in creating both backend and frontend on the same DocumentRoot as you are trying to do. Also the wiki you've mentioned looks too complex to me. (You know, I'm extremely fond of simpleness and easiness.)

What I can say is that you will be happier if you follow the standard way of doing, that is, constructing backend and frontend on the different DocumentRoots.

And consider using Yii 2.0, if you haven't written a lot so far using Yii 1.1. Yii 2.0 is much sweeter. :)
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users