Working
- dev.ov-ervaringen.nl/
- dev.ov-ervaringen.nl/posts/index
Not working:
- dev.ov-ervaringen.nl/index.php
- dev.ov-ervaringen.nl/index.php
The error (Notice (8): Undefined index: post) in /posts/index was a typo.
I removed all the web.config files in /app/ and /app/webroot/, and created one web.config in /root/, which contains the following:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<directoryBrowse enabled="false" />
<defaultDocument>
<files>
<clear />
<add value="index.htm" />
<add value="index.html" />
<add value="index.php" />
<add value="Default.htm" />
<add value="Default.asp" />
<add value="Default.aspx" />
</files>
</defaultDocument>
<rewrite>
<rules>
<rule name="Imported Rule 1" stopProcessing="false">
<match url="^$" ignoreCase="false" />
<action type="Rewrite" url="app/webroot/" />
</rule>
<rule name="Imported Rule 2" stopProcessing="false">
<match url="(.*)" ignoreCase="false" />
<action type="Rewrite" url="app/webroot/{R:1}" />
</rule>
<rule name="Imported Rule 5" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
<action type="Rewrite" url="index.php?url={R:1}" appendQueryString="true" />
</rule>
<rule name="Imported Rule 6" stopProcessing="true">
<match url="^$" ignoreCase="false" />
<action type="Rewrite" url="/" />
</rule>
<rule name="Imported Rule 7" stopProcessing="true">
<match url="(.*)" ignoreCase="false" />
<action type="Rewrite" url="/{R:1}" />
</rule>
<rule name="Imported Rule 8" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
<action type="Rewrite" url="index.php/{R:1}" appendQueryString="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Don't mind the interrupted names: IIS7 doesn't care about names, it'll work from top to bottom.
When I had rule 1 and 2 removed, all my CSS markup was gone on every page.
But now... How to fix the /index.php problem... :-\
Ciao,
Jorick.
Op donderdag 29 november 2012 13:44:38 UTC+1 schreef Jorick de Lange het volgende:
Hi everyone,So, I (we, actually) decided to create a website. Because of the need to extend later on, we decided to use a framework. CakePHP looked very well to fit our needs. Installed it, configured it, and after some .htacces import to web.config files, it was functional! See http://dev.ov-ervaringen.nl/ for the default page of CakePHP.Happy as I was, I started to follow the blog tutorial. Created the desired pages and I came to the point where you actualy can see the magic happen: I browsed to http://dev.ov-ervaringen.nl/posts/index/ and... Nothing. OK, back to the tutorial, to make sure I didn't make a typo. Nothing. Everything seems fine.Now, I'm stuck. I don't have a clue where to search for the problem.Here are the files:in app/Controller/PostsController.php class PostsController extends AppController {
public $helpers = array('Html', 'Form');
public function index() {
$this->set('posts', $this->Post->find('all'));
}
}in app/Model/Post.phpclass Post extends AppModel {
}in app/View/Posts/index.ctp<!-- File: /app/View/Posts/index.ctp -->
<h1>Blog posts</h1>
<table>
<tr>
<th>Id</th>
<th>Title</th>
<th>Created</th>
</tr>
<!-- Here is where we loop through our $posts array, printing out post info -->
<?php foreach ($posts as $post): ?>
<tr>
<td><?php echo $post['Post']['id']; ?>></td>
<td>
<?php echo $this->Html->link($post['Post']['title'], array('controller' => 'posts', 'action' => 'view', $post['post']['id'])); ?>
</td>
<td><?php echo $post['Post']['created']; ?></td>
</tr>
<?php endforeach; ?>
<?php unset($post); ?>
</table>And, my web.config files:
in root:<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<directoryBrowse enabled="false" />
<defaultDocument>
<files>
<clear />
<add value="index.htm" />
<add value="index.html" />
<add value="index.php" />
<add value="Default.htm" />
<add value="Default.asp" />
<add value="Default.aspx" />
</files>
</defaultDocument>
<rewrite>
<rules>
<rule name="Imported Rule 1" stopProcessing="true">
<match url="^$" ignoreCase="false" />
<action type="Rewrite" url="app/webroot/" />
</rule>
<rule name="Imported Rule 2" stopProcessing="true">
<match url="(.*)" ignoreCase="false" />
<action type="Rewrite" url="app/webroot/{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>in app/<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<directoryBrowse enabled="false" />
<rewrite>
<rules>
<remove name="Imported Rule 1"/>
<remove name="Imported Rule 2"/>
<rule name="app 1" stopProcessing="true">
<match url="^$" ignoreCase="false" />
<action type="Rewrite" url="webroot/" />
</rule>
<rule name="app 2" stopProcessing="true">
<match url="(.*)" ignoreCase="false" />
<action type="Rewrite" url="webroot/{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>in app/webroot/<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<remove name="app 1"/>
<remove name="app 2"/>
<rule name="App Webroot 1" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" appendQueryString="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>---Is there anyone who is seeing the problem and has the solution to solve it?
Thanks in advance,Jorick.
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
No comments:
Post a Comment