Jump to content
Larry Ullman's Book Forums

Url Paths When There Are Multiple Sites


Recommended Posts

 

Hi,

 

I have a bit of an odd (for me) problem.  I originally created a yii site on a production server

to play around with, and it worked fine. (1.1.13)

 

In earnest, I created a site on my local server recently, which is working fine. (1.1.14)

 

I removed the old installation from my production server, installed 1.1.14, and zipped/uploaded

my local yii site.

 

On my local site, the path is /var/www/<sitename>/index.php

On my production server (GoDaddy), the path is ~/html/<domainname>/<sitename>/index.php

 

Now links are showing up on the production site as:

domainname.com/domainname/sitename/index.php

/domainname/ does not belong and is causing 401 errors.

 

I had UrlManager turned on, but had not yet customized the paths, so they are the default ones,

normally I would see (on my local server) domainname.com/index.php/site/index for example,

and I expect in production to see domainname.com/sitename/index.php/site/index.

 

Any ideas?  I've tried setting homeUrl and BaseUrl and loginUrl directly, but none of it makes

a difference.

 

Thanks,

Malcolm

Link to post
Share on other sites

Additional notes:

 

With UrlManager turned off, links look correct, i.e.:
domain.com/sitename/index.php?r=site/page&view=about

 

With UrlManager turned on to the default settings, I get the above errors.

 

Default Settings:

                'urlManager'=>array(
                        'urlFormat'=>'path',
                        'rules'=>array(
                                '<controller:\w+>/<id:\d+>'=>'<controller>/view',
                                '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
                                '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
                        ),
                ),
 

 

Interestingly enough, when this is malfunctioning, the main menu links are all incorrect, but the breadcrumb links are actually correct.

I assume I just need to change the rules in UrlManager, but I'm not sure what the best way to do that is, as I'm not really familiar with this aspect.  I was planning on using the "hide index.php" rules later before we go live, so if anyone has a way to fix my existing problem, and include that, that'd be perfect.

 

Many thanks!

Link to post
Share on other sites
  • 2 weeks later...

No, not yet.  Although to be honest, with the holidays, I haven't done much of anything the past few weeks.  Right now, I'm playing with my development environment, setting it up to match GoDaddy's setup more so I can keep things in sync better once I find the answer.

 

I've tried playing with urlManager rule settings, for example, changing:

'view:(about)>' => 'site/page',

'<controller:\w+>/<id: \d+>' => '<controller>/view',

 

to:

'view:(about)>' => 'sitename/site/page',

'<controller:\w+>/<id: \d+>' => 'sitename/<controller>/view',

 
but that doesn't work...probably because it's probably trying to go through the index.php first, which would fail.
 
So if you have any quick ideas, that'd be great!
 
Thanks,
Malcolm
Link to post
Share on other sites

If it wasn't clear above, I modified my dev server to be like my real server.

 

GoDaddy:

/home/user/html/domainname/sitename/index.php

 

Dev:

/var/www/domainname/sitename/index.php

 

I would have hoped this would result in identical environments for this, but GoDaddy is doing something different.

 

I changed my urlmanager rules back to normal on my dev server:

 

'urlManager'=>array(
'urlFormat'=>'path',
'rules'=>array(
                '/' => 'site/index',
                'home' => 'site/index',
                '<view:(about)>' => 'site/page',
                '<controller:\w+>/<id:\d+>'=>'<controller>/view',
                '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
                '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
              ),
             // 'showScriptName'=>false,
             // 'urlSuffix'=>'.html',
),
 
And my .htaccess file at the index.php level:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ /index.php? [L]
 
 
On my Dev server, no problems.
 
However, using these same settings on the live server still results in links being written as:

h.t.t.p.:././domainname.com/domainname/sitename/index.php/site/login
instead of h.t.t.p.:././domainname.com/sitename/index.php/site/login
 
Ugh.  I feel like I'm missing something simple and I will bang my head on a wall when I figure it out.
 
Link to post
Share on other sites
  • 4 weeks later...
  • 1 month later...

Sorry, this year has been crazy so far.  I've been dropping the ball too.

 

GoDaddy has this format:

"home" path: /var/chroot/home/content/12/123456789/

 

webroot is then: /var/chroot/home/content/12/123456789/html

 

Multiple domain names are like this:

~/html/domainone

~/html/domaintwo

~/html/domainthree

 

My purpose is making a customer review site.  The customer doesn't have their own hosting yet, so I'm just loading their site up on one of my domains, such as:

 

~/html/domainfive/customername/  <-- this should be what Yii thinks is the webroot.

 

It's not a huge issue.  I'm just turning off URL management for now.  And when they go live, it'll have it's own hosting, so this shouldn't matter anyways.  Just bugs me when things don't work and I'm not sure why.

 

:)

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...