PDA

View Full Version : Getting htaccess to work on localhost


cinq
01-20-2005, 01:02 AM
I cant seem to get it working.
I am using wamp ( wampserver.com ).

I placed a .htaccess file in my www directory with certain mod_rewrite rules, but it never seems to work.

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, webmaster@localhost 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.



Is there some config I have to do first, and if so, what ?

Andreas
01-20-2005, 01:06 AM
What's in error_log?

cinq
01-20-2005, 01:09 AM
What ( or where ) is the error log ?
Sorry new to this :(

However I got it to work by editting the httpd.conf file
Uncommented the following lines :
LoadModule rewrite_module modules/mod_rewrite.so
AddModule mod_rewrite.c

I am trying to code my hack with mod_rewrite implemented.
As such, is there a way to 'tell' if your server ( say a person who wants to install my hack ) has this capability ( mod_rewrite ) ?

Andreas
01-20-2005, 01:16 AM
error_log (at least this is the default filename) is apaches error logfile.
It's in the logs directory for apache.
But where this is on your system?
That's one thing you must know as it is your system :)

To check for mod_rewrite:


if (functions_exists('apache_get_modules')) {
if (in_array('mod_rewrite', apache_get_modules()) {
// mod_rewrite is loaded
}
}


This does tell you if the module is loaded.
But this does not necessarily mean that it is being used.

cinq
01-20-2005, 01:23 AM
Ah i found it ( apache folder/logs )


[Thu Jan 20 11:02:21 2005] [alert] [client 127.0.0.1] c:/program files/wamp/www/newforum/.htaccess: Invalid command 'RewriteEngine', perhaps mis-spelled or defined by a module not included in the server configuration

So it was the module not included ( which uncommenting those 2 lines took care of :) )

Thanks for the check Kirby, would be useful for those installing the hack to check if mod_rewrite is allowed before installing.
:)