RewriteRule: content ok but 404 returned in HTTP :
Posted by: DejanVesic
Posted on: 2006-03-08 12:55:00
Hello.
I have very strange problem; I changed structure of my site and used WordPress now to serve all pages on site.
One of the pages was:
http://www.vesic.org/english/
Now, that content is served now by calling:
http://www.vesic.org/index.php?p=21
I wanted to preserve nice URL's, so I created following section in .htaccess file:
#BEGIN /english section
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^english$ /english/ [R=301]
RewriteRule ^english/index.php$ /english/ [R=301]
RewriteRule ^english/index.html$ /english/ [R=301]
RewriteRule ^english/$ /index.php?p=21 [L]
</IfModule>
#END /english section
Now, behaviour is very strange:
- if you open http://www.vesic.org/english/ in browser you WILL get content BUT you will also get HTTP/1.x 404 code in header :-( (you need some tool which reports HTTP header info) which means "Page not found".
Can I somehow force Apache not to emit 404 code, i.e. to check FIRST if there is RewriteRule for given URL and ONLY if there is no such rule to emit 404?
Regards,
Dejan