Forum Moderators: bakedjake

Message Too Old, No Replies

Combining "ReWriteEngine" and "ErrorDocument"

Help!

         

born2drv

4:01 am on Jan 22, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm having a problem trying to combine the "ReWriteEngine" with the
"ErrorDocument" redirect in .htaccess.
ReWrite works fine using the following syntax...

RewriteEngine on
RewriteRule ^(.*)$ ../cgi-bin/shop.cgi?url=$1

And the redirect works fine link this:
ErrorDocument 404 [mydomain...]

BUT, I can't seem to combine the 2 functions. What I want to do is perform
the ReWrite ONLY when the page cannot be found. Something like this:

RewriteEngine on
RewriteRule ErrorDocument 404 ../cgi-bin/shop.cgi?url=$1
(obviously, this doesn't work)

The reason being, I want to put this .htaccess in my root htdocs folder, but
want users to still be able to access the .html files that are there.

Please help!

jdMorgan

4:21 am on Jan 22, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



born2drv,

This thread [webmasterworld.com] demonstrates how to redirect missing image files. You can generalize it to accomplish what you need to do.

Jim

hakre

5:49 am on Jan 22, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



nice pick jd!

jdMorgan

6:05 am on Jan 22, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



hakre,

I didn't want to write it (msg #12) twice! :)

Jim