UrlManager delete pictures

You can try a quick and dirty test to find out wether .htaccess is ignored or not. Put this into your .htaccess file:


WILL-NOT-WORK



Now open the page. You should get a “500 Internal server error” if your .htaccess is read. If you don’t get an error it’s still ignored.

error 404… -.-

do i place maybe my .htaccess wrong?

again plz. my folder structure under htdocs. where all the magic happens.

htdocs\yii\here i got:(framework|requirements|start)\under start i got:(css|…|protected|…|htaccess)

htdocs\yii\start\htaccess -> is this correct?

i have also tried to use htaccess without a . infront of name. still nothing happens…

what’s with the htaccess in the diretory protected. i have read that htaccess files in sub directories overwrite the htaccess files in parent directories

If I understood you… start is the folder with your application

I would suggest to put start under htdocs… not in the Yii folder structure…

so that you have

htdocs/Yii - only the framework

htdocs/start - your application

.htaccess (note that this file begins with a dot - without the dot it does not work) goes in the start folder

.htaccess in the subdirectory adds to the htaccess in the parent directory depending of the content

OK.

I’ve changed my directories. But still the same problem…

OK. It seems like my .htaccess is ignored.

but the module is on.

do i have to change something in my vhosts or in my php.ini?

Ok.

it seems like i got some problems with my httpd-vhosts.conf.


NameVirtualHost localhost

<VirtualHost 127.0.0.1>

	ServerName localhost

        AddType text/html .shtml

	AddDefaultCharset UTF-8

    AddHandler server-parsed .shtml

    ServerAdmin bla@bla.de

    DocumentRoot "D:/xampp/htdocs"

    ScriptAlias /cgi-bin/ "D:/xampp/htdocs/cgi-bin/"


    <Directory "D:/xampp/htdocs">

		Options Indexes FollowSymLinks

		Options +Includes

		#Options +

		AllowOverride FileInfo

		AllowOverride All

		Order allow,deny

		Allow from all

		DirectoryIndex index.php index.shtml index.html index.htm

    </Directory>

</VirtualHost>

i changed allowoverride to all. now i get an server error.

my .htacces look like this. an is under the directory start.


Options +FollowSymLinks

IndexIgnore */*

<IfModule mod_rewrite.c>

RewriteEngine on


# 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

</IfModule

someone an idea?

It makes no sense to change the .htaccess if it’s ignored. :rolleyes:

So first find out what’s wrong with your Apache config.

Actually you can also put all your .htaccess configuration into the VirtualHost section of your httpd.conf. That’s faster anyway as enabling .htaccess slows down Apache a little.

Oh, and you did restart your Apache after changing the config file, did you?

restarting it everytime.

can u show me an exmaple for puting this rewrite stuff into my vhost?

i found out, that if i set allowoverride to None, i can see the page. put url manager doesnt works propably.

and if i allow the override, i get an server error. says that something is wron with my cgi-script.

You can do like:


<VirtualHost 127.0.0.1>

        ServerName localhost

        AddType text/html .shtml

        AddDefaultCharset UTF-8

...

    <Directory "D:/path/to/your/project">

            RewriteEngine on


            # 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

    </Directory>

</VirtualHost>




NameVirtualHost localhost:80

<VirtualHost 127.0.0.1>

	AddDefaultCharset UTF-8

    DocumentRoot "D:/xampp/htdocs"

	ServerName localhost

    ServerAdmin bla@bla.de

	AddType text/html .shtml


    <Directory "D:/xampp/htdocs/start">

		RewriteEngine On

			

			# 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

    </Directory>

</VirtualHost>

still get an error 500

Check Apache’s error log.

ok. got it now with the url. but don’t know if the image problem is solved too.

i moved my folders in another direction and had to chek now the pat to the framework. take few minutes. so plz stay with me.

my apache is now configured like this:


NameVirtualHost localhost:80

<VirtualHost 127.0.0.1>

	AddDefaultCharset UTF-8

    DocumentRoot "D:/xampp/htdocs"

	ServerName localhost

    ServerAdmin bla@bla.de

	AddType text/html .shtml


    <Directory "D:/xampp/htdocs/start">

		AllowOverride All

		RewriteEngine On

			

			# 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

    </Directory>

</VirtualHost>

i realised, that u need the line with AllowOverride. If u dont have this, the server crashes.

doin it now without a .htaccess

OK. So the url problem is solved now. but i still can’t see my images. and i also can’t find now my static pages…

There is a little mistake in the end (missed ">" symbol):


Options +FollowSymLinks

IndexIgnore */*

<IfModule mod_rewrite.c>

RewriteEngine on


# 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

</IfModule>

ok thx.

but the url are show fine now. got the problem, that my images are not displayed.

What is the output when you try to access any image directly?

a broken symbol.

and. coult it be, that the extension: MBMenu doenst work correctly with the urlManager?

because if i set the ‘showScriptName’=> false

i get always a 404 exception. do i have to add something more to the urlManager? some rules?

with the stadard yii menu it works perfect!

ok urls works fine now.

MbMneu. Everything is fine.

But the problem with the images still exists.

and does anybody know why my images are broken?

do i have to declare also rules for the images in the url manager?.

because when i view the source code, and i try to open the image, i get an 404 Exception.

and the image is nothing else than an url…

Compare the url of the image with the actual path on the filesystem.

Do you get a 404 exception from Yii or from Apache?

compared:

both the same.

i get the 404 by the apache. but only if i’m using url manager. without it works great.

shall i add anything to my config?

found something out.

in my main.php under views/layout.

if i’m using:


CHtml::image('/images/stbg-logo-de.gif')

on localhost/project

image is not shown | 404 on apache.

elseif:


CHtml::image('images/stbg-logo-de.gif')

on localhost/project

image is shown.

elseif:


CHtml::image('images/stbg-logo-de.gif')

on localhost/project/site/xyz

image is not shown | 404 on yii.

i need to change something in the url manager or define some rules.

anyone an idea?


CHtml::image('/images/stbg-logo-de.gif')

doesn’t work because it refers to localhost/images/stbg-logo-de.gif

You don’t need to change url manager. Are you sure RewriteCond works for project/site/xyz path?