Is there a mistake in this mod_rewrite rule?

New to mod_rewrite? This is a good place to start.

Is there a mistake in this mod_rewrite rule?

Postby Markus Klaffke » Fri Sep 10, 2004 3:32 am

Hi,

the following rule is not my own creation. It is from this page

http://www.movabletype.org/docs/mtmanual_dynamic.html

and I use Movabletype as a CMS.

This is it:

# Disable fancy indexes, so mtview.php gets a chance...
Options -Indexes
<IfModule mod_rewrite.c>
# The mod_rewrite solution is the preferred way to invoke
# dynamic pages, because of its flexibility.
# Add mtview.php to the list of DirectoryIndex options, listing it last,
# so it is invoked only if the common choices aren't present...
<IfModule mod_dir.c>
DirectoryIndex index.php index.html index.htm default.htm default.html default.asp /mtview.php
</IfModule>
RewriteEngine on
# don't serve mtview.php if the request is for a real directory
# (allows the DirectoryIndex lookup to function)
RewriteCond %{REQUEST_FILENAME} !-d
# don't serve mtview.php if the request is for a real file
# (allows the actual file to be served)
RewriteCond %{REQUEST_FILENAME} !-f
# anything else is handed to mtview.php for resolution
RewriteRule ^(.*)$ /mtview.php [L,QSA]
</IfModule>
<IfModule !mod_rewrite.c>
# if mod_rewrite is unavailable, we forward any missing page
# or unresolved directory index requests to mtview
# if mtview.php can resolve the request, it returns a 200
# result code which prevents any 4xx error code from going
# to the server's access logs. However, an error will be
# reported in the error log file. If this is your only choice,
# and you want to suppress these messages, adding a "LogLevel crit"
# directive within your VirtualHost or root configuration for
# Apache will turn them off.
ErrorDocument 404 /mtview.php
ErrorDocument 403 /mtview.php
</IfModule>


My first problem is this line:

Code: Select all
<IfModule !mod_rewrite.c>


The

!


is wrong - yes?

The second problem is this line:

# anything else is handed to mtview.php for resolution
RewriteRule ^(.*)$ /mtview.php [L,QSA]


If i enable this line i cannot access my /cgi-bin/. If i comment it out, everything goes well.

My apache log gives me this error: Premature end of script headers ...mtview.php.

Is there a mistake in that line?

To understand this: I have installed the CMS in a very simple VHost on my server. I have a line for documentroot and for scriptAlias. Nothing more.

Thanks in advance
Markus

P.S.: I have also posted this in the Movable Support Forum, but without a answer, not even from the owner of the site.
Markus Klaffke
 
Posts: 1
Joined: Fri Sep 10, 2004 3:20 am

Return to Beginner's Corner

Who is online

Users browsing this forum: No registered users and 40 guests

cron