Path Problems In Subdirectory

Hi all,

I’m trying to move a Yii application from one server to another and wanted to clean up the directory structure. The application is running perfectly on the old server.

My new directory structure is as follows (for an URL [font="Courier New"]www.myurl.com[/font]):


. root

+-- yiiapp



Thus, the main page, [font="Courier New"]www.myurl.com/index.php[/font] is unrelated to yii. The Yii application is accessed through [font="Courier New"]www.myurl.com/yiiapp/index.php[/font].

I have two problems (which I think is the same problem really).

[list=1]

[*] I have a logo located in [font=“Courier New”]/yiiapp/css/logo.gif[/font] that is not found and showed on the main page. The corresponding code is rendered [font=“Courier New”]<img width=“40%” src="/css/logo.gif">[/font]. However, if I copy the content of css to [font=“Courier New”]/css/logo.gif[/font] then everything works fine. In other words I’m getting the site root instead of the app root. Where do I need to change that?

[*] I have a mail queue that I’d like to empty by running the command


claus@ican:$ ./yiic mail send

Preparing to send notifications.

PHP Error[2]: include(Mail.php): failed to open stream: No such file or directory

    in file /home/claus/web/yii-1.1.13.e9e4a0/framework/YiiBase.php at line 421

.

.

.



So somehow I’m not getting hold of [font=“Courier New”]Mail.php[/font] although it can be found in [font=“Courier New”]protected/models/Mail.php[/font].

This has to be a path problem as well.

[/list]

Can anyone point me in the right direction?

Cheers,

Claus


<img width="40%" src="<?php echo Yii::app()->baseUrl;?>/css/logo.gif">

or if it’s in a theme


<img width="40%" src="<?php echo Yii::app()->theme->baseUrl;?>/css/logo.gif">

if you have a .htaccess add the following to it if not create one and put it in the root of your yii app (same level as index.php)




#Use if on not in the main root folder.

RewriteBase /

For all of my sites i make in yii i have to do the above if it’s not in the main root or on shared hosting. Yours might be the same problem bc it’s in website/yiiapp

Hi and thank you for your reply.

I’ve changed [font=“Courier New”]RewriteBase[/font] from [font=“Courier New”]RewriteBase /yiiapp[/font] to [font=“Courier New”]RewriteBase /[/font] so my [font=“Courier New”].htaccess[/font] file in the [font=“Courier New”]yiiapp[/font] directory reads




Options +FollowSymLinks

IndexIgnore */*

RewriteEngine on

RewriteBase /

# //This line must require in your .htaccess.


# 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 . index.php



Sadly that does not fix the access to the logo file. In fact I cannot see a single change after adding that.

Cheers,

Claus

Hi

Am not clear your requirement It may be use for you try this…

Make url path below way …this is my sample using project

<?php

$path1 = $url = Yii::app()->getBaseUrl(true);

$path = substr($path1,0,strlen($path1)-5); ?>

<span class="checkbox-wrapper">

<a href="<?php echo $path; ?>">Home</a>&nbsp;&nbsp;

<a href="<?php echo $path."/Forgetpassword.php"; ?>" >Forgot Password</a>

</span>

or

&#036;host =&#036;_SERVER['HTTP_HOST'];





&lt;a href=&quot;&lt;?php echo 'http://'.&#036;host.'/url file path'; ?&gt;&quot;&gt;&lt;img src=&quot;images/beta.png&quot; alt=&quot;&quot; /&gt;


   &lt;/a&gt;