Go Back   CodingForums.com > :: Server side development > Apache configuration

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-07-2011, 01:51 PM   PM User | #1
abduraooft
Supreme Master coder!

 
abduraooft's Avatar
 
Join Date: Mar 2007
Location: N/A
Posts: 14,678
Thanks: 158
Thanked 2,182 Times in 2,169 Posts
abduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really nice
htaccess rewrite messes with the error document?

M'kay

I'm going to open a new thread, after my 'unanswered' one in the same forum, since I'd like to give a new title and some demo links.

I need to redirect all incoming requests to index.php, using .htaccess, and based on the $_SERVER['REQUEST_URI'], index.php will serve the pages. If the incoming request is not a valid one, a 404 header also need to be passed.

So, the short version of my files are as follows
index.php
PHP Code:
<?php
header
'Status: 404' ); 
?>
<!DOCTYPE html>
    <title>Test</title>
<body >
  <h1 > 
    Header
  </h1>
<div>Lorem ipsum [...]</div>
  <hr/>
     Footer
      <hr/>
</body>
.htaccess
Code:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [L]
#I'm not the first one to try the above rule, it's taken from Wordpress's permalink-htaccess
The url is http://my-spread.com/error_test/. There's nothing more inside this directory, other than the above two files.

Now, all the (virtual) urls that may point to static files like foo, foo.txt, foo.bar, foo.html etc are okay in all browsers (including lynx!)

But, all (virtual) urls that may point to dynamic files like foo.php, foo.py, foo.pl, foo.rb are showing the error (Chrome somehow fixes the output, illegally? ).

Additionally, the output of index.php is even strange!

(And here's the phpinfo, for those interested)

My mind doesn't allow me to believe that apache can show miracles, as "they" do. What do you think?

PS: I'm almost sure that it's all due to the lack of knowledge of the so called "techies" of the hosting team, and by the virtue of it I'm very reluctant to leave them
__________________
Quote:
The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)
abduraooft is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:32 PM.


Advertisement
Log in to turn off these ads.