Forum Moderators: mack

Message Too Old, No Replies

How to avoid the 404 signature

may be it's curiously but we need some help

         

AlexeyMas

11:06 pm on Jun 1, 2003 (gmt 0)

10+ Year Member



We construct some special scheme for site engine. On using it you have no files on /htdocs (or some else)...

All site pages construct as 404 error message (you can see it on our page <snip> ). We have .htaccess to readdress all query to our script.

This way is beautiful but we have some troubles on it.

All answers of Apache web server are started as 404...
And search engines can't to see pages constructed by this way.

How we can to avoid 404 signature on this?

[edited by: Woz at 12:08 am (utc) on June 2, 2003]
[edit reason] no URLs please see TOS#13 [/edit]

jdMorgan

1:58 am on Jun 2, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



AlexeyMas,

Welcome to WebmasterWorld [webmasterworld.com]!

Instead of using the default 404-Not found mechanism of the server and a custom ErrorDocument directive, you can have .htaccess check for the page's existence BEFORE any response from the server. The following code will redirect all non-existent pages to myscript.php and append the requested page path as a query string:


RewriteCond %{REQUEST_URI} !-U
RewriteRule ^(.*)$ /myscript.php?page=$1 [L]

Note that this is not very efficient, but it may serve as a temporary solution until you figure out a better way. I am posting this because I'm not sure I fully understand what you are trying to do, so I can't suggest anything better.

Ref: Apache mod_rewrite RewriteCond [httpd.apache.org]

Jim

AlexeyMas

11:30 pm on Jun 2, 2003 (gmt 0)

10+ Year Member



Thank you very match...

We have some troubles with it :)

RewriteEngine On
RewriteCond %{REQUEST_FILENAME}!-f
RewriteRule ^(.*)$ /cgi-bin/rejump_db.pl?$1 [L]

One - to turn on. It was disabled.
One - -f mode... I don't understand but!-U mode in RewriteCond does not work on our server...

Do you know why? We break some good heads on it.

P.S. Is Rewrite your specialization? I see a lot of your post's for this theme.

jdMorgan

12:41 am on Jun 3, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Alexymas,

It may be necessary to add


Options +FollowSymLinks

before "RewriteEngine on" in order to make -U work properly. But if -f works, then use -f instead.

I don't specialize in mod_rewrite, but I enjoy the challenge.

I hope you got it working!

Jim