Mr.Shawn Posted January 29, 2008 Share Posted January 29, 2008 I have an .htacces server error but I still can't figure out where the problem lies... RewriteEngine on RewriteRule ^(.*)$ /index.php?page=$1 [L] Quote Link to comment https://forums.phpfreaks.com/topic/88324-solved-htaccess-server-error/ Share on other sites More sharing options...
madmax Posted January 29, 2008 Share Posted January 29, 2008 Error message? Clues? Apache version? OS Version? ??? Your rewrite rule appears to allow a situation where it would redirect the current URL and map this URL entirely onto the end of the new query string. Did you intend this? (e.g. /index.php?page=/docs/widgets/page=41 ???) If all you want to do is append the page value then create a back-reference using RewriteCond and use this in the rewriterule to remap I don't personally recommend .htaccess - see the Apache site for when and why http://httpd.apache.org/docs/2.0/howto/htaccess.html#when Quote Link to comment https://forums.phpfreaks.com/topic/88324-solved-htaccess-server-error/#findComment-452226 Share on other sites More sharing options...
Mr.Shawn Posted January 31, 2008 Author Share Posted January 31, 2008 Server error! The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there was an error in a CGI script. If you think this is a server error, please contact the webmaster. Error 500 localhost 01/31/08 16:31:01 Apache/2.2.3 (Win32) DAV/2 mod_ssl/2.2.3 OpenSSL/0.9.8d mod_autoindex_color PHP/5.2.0 This is the error that I had got. Quote Link to comment https://forums.phpfreaks.com/topic/88324-solved-htaccess-server-error/#findComment-454194 Share on other sites More sharing options...
PFMaBiSmAd Posted January 31, 2008 Share Posted January 31, 2008 It is highly likely that the mod_rewrite is not enabled. Find the following line in your httpd.conf and remove the # at the start of it. Stop and start your web server to get any changes made to httpd.conf to take effect - Change this line - #LoadModule rewrite_module modules/mod_rewrite.so to this - LoadModule rewrite_module modules/mod_rewrite.so Quote Link to comment https://forums.phpfreaks.com/topic/88324-solved-htaccess-server-error/#findComment-454315 Share on other sites More sharing options...
madmax Posted January 31, 2008 Share Posted January 31, 2008 Have you tried commenting-out the rewrite rules to actually *prove* that these rules are the problem or are you assuming that they're the problem? If you've proven it is these two lines actually triggering the issue by the server working fine when commented out then there are other steps you can try. Quote Link to comment https://forums.phpfreaks.com/topic/88324-solved-htaccess-server-error/#findComment-454582 Share on other sites More sharing options...
Mr.Shawn Posted February 1, 2008 Author Share Posted February 1, 2008 Yes. I have commented out the httpd.conf and also commented out the code. #RewriteRule ^(.*)$ /index.php?page=$1 [L] The server actually works. So this means that my RewriteRule is the one that causing my problem? Quote Link to comment https://forums.phpfreaks.com/topic/88324-solved-htaccess-server-error/#findComment-455060 Share on other sites More sharing options...
Mr.Shawn Posted February 1, 2008 Author Share Posted February 1, 2008 Yes. I have commented out the httpd.conf and also commented out the code. #RewriteRule ^(.*)$ /index.php?page=$1 [L] Mysteriously, the below code works while the upper one don't. RewriteRule ^(.+)$ /index.php?page=$1 [L] Anyone can tell me what is the problem between (.*) and (.+) Quote Link to comment https://forums.phpfreaks.com/topic/88324-solved-htaccess-server-error/#findComment-455063 Share on other sites More sharing options...
madmax Posted February 1, 2008 Share Posted February 1, 2008 The difference lies between 0 or more and 1 or more, not sure about the problem I think you need to pinpoint the cause rather than simply making assumptions I'd do a tail -f on the logs and watch what actual log entries happen for bother error and access logs for given URLs One you can pinpoint an offending URL request which you can prove triggers the 500 error you can then analyse the logs and confirm the nature any connection between the rewrite rules and the error You say you commented the httpd conf file but if .htaccess are in use have you checked to ensure that no other .htaccess file is triggering the error. You may need to search for all offending .htaccess files in the given search path. See here for why .htaccess files in more than one folder may be referenced for any given request (and why I don't use them myself) http://httpd.apache.org/docs/2.0/howto/htaccess.html#when Quote Link to comment https://forums.phpfreaks.com/topic/88324-solved-htaccess-server-error/#findComment-455209 Share on other sites More sharing options...
Mr.Shawn Posted February 2, 2008 Author Share Posted February 2, 2008 Understood. Thanks for the resources madmax. Quote Link to comment https://forums.phpfreaks.com/topic/88324-solved-htaccess-server-error/#findComment-456010 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.