Strange php behavior
<p>i was busy on my website doing url rewrites when suddenly something happent from wich i realy dont know how it happent or how this is possible and how to maybe prohibit this from happening, probaby some litle mistake in the url rewrite rule where i try to force the www in front of the address but when i remove the www. and press enter it comes up with an address wich he cant find cause he doesnt put a / behind the .nl</p>

<p>somehow a extra index.php got fixed in between and what happens that in this way the whole website can be seen without any css markup ... :S</p>

<p>it is reproducable, just fit the extra index.php in between like the xample and the whole website can be seen and surfed without any markup from the css file</p>

<p>[http://www.capoeiravelsen.nl/index.php/index.php?page=home]</p>

<p>what is actualy happening here ? why aint it reading the css file in this way. ofcourse users are not just gonna fix the extra index.php in between but does this presents a sort of security breach or bug or whatever ....</p>

<blockquote>
  <p>[EDIT]</p>
  
  <p>yeah it sounds logic that it cant fetch the css cause it looking in a
  differend directory or something, still dont know how it still can
  fetch all the other docs then since a folder named index.php doesnt
  exist in any way.</p>
  
  <p>it happent with this rewrite rule:</p>

<pre><code> RewriteCond %{HTTP_HOST} !^www\.         [NC]
 RewriteCond %{HTTP_HOST} (.*)
 RewriteRule (.*)         http://www.%1$1 [R=301,L]
</code></pre>
  
  <p>where i forced the www in the address, but when a some random crazy
  user would want to delete the www. and pressed enter the weird effect
  occurs.</p>
  
  <p>the request would then change to:
  [http://www.capoeiravelsen.nlindex.php/?page=home] where the browser
  says it cant find that page ofcourse</p>
  
  <p>not noticing the / in between .php and ? i putted a / in between .nl
  and index.php so it would become
  [http://www.capoeiravelsen.nl/index.php/?page=home] and pressed enter</p>
  
  <p>then the whole address changed to:
  [http://www.capoeiravelsen.nl/index.php/index.php?page=home]</p>
  
  <p>where browsing the site is possible but without markup...</p>
  
  <p>I solved this issue by changing the rewrite rule to:</p>

<pre><code> RewriteCond %{HTTP_HOST} !^www\.
 RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
</code></pre>
  
  <p>when some random user would delete the www. and pressed enter nothing
  crazy happens the www. just gets forced again</p>
</blockquote>
