Hi,

I put the following in my .htaccess
PHP Code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase 
/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond 
%{REQUEST_FILENAME} !-d
RewriteRule 
. /index.php?keyquery=blabla [L]
</
IfModule
Simple enough. That means if I request

http//domainname.com/blablawhateverhelloworld

my site will call http//domainname.com/index.php?keyquery=blabla instead. Latter, in index.php, I can do stuffs like $keyquery = $_GET['keyquery'];

Simple.

There is one annoying fact though.

When
http//domainname.com/ is requested by the browser, the server will give http//domainname.com/index.php rather than http//domainname.com/index.php?keyquery=blabla

In other words, $keyquery = $_GET['keyquery']; in index.php will give nothing.

How do I ensure that when the server access http//domainname.com/ it'll also display the content of http//domainname.com/index.php?keyquery=blabla

One solution I tried is to delete RewriteCond %{REQUEST_FILENAME} !-f

However, I simply got:
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.


Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

It seems that it means the server tries to access http//domainname.com/index.php?keyquery=blabla however, the .htaccess directive tries to redirect it to http//domainname.com/index.php?keyquery=blabla, which will try to redirect it to http//domainname.com/index.php?keyquery=blabla, and so on and so on.

That's why delete RewriteCond %{REQUEST_FILENAME} !-f is needed.