.htaccess can not work

Problems with the Windows version of XAMPP, questions, comments, and anything related.

.htaccess can not work

Postby trieunguyen » 06. October 2007 05:40

Hi all,

when i create .htaccess file content
(
rewriteengine on
rewriterule .*index.php
php_flag magic_quotes_gpc off
php_flag register_globals off
)
then I run the program and a message display : 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.

Please, give me the solution. Thanks a lot.
trieuthanhnguyen
trieunguyen
 
Posts: 1
Joined: 04. October 2007 10:38
Location: vietnam

Postby Izzy » 06. October 2007 06:13

What does your error log say about the server error?

When ever you have a server error always check your server's error log first for clues.
xampp\apache\logs\error.log

Apache is case sensitive:
RewriteEngine on
and drop the brackets ( )

http://httpd.apache.org/docs/2.3/howto/htaccess.html
http://httpd.apache.org/docs/2.3/mod/mod_rewrite.html


=================================================
Take a look at the new DeskTopXampp launch control for XAMPP and XAMPPlite (DTX.exe)
http://nat32.com/dtx/
posted by ridgewood:
http://community.apachefriends.org/f/viewtopi ... 967#103967
Also available here: http://zedfiles.com/DTX/
I highly recommend DTX.
=================================================
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Postby KallistaAEnvarou » 02. December 2007 18:27

I'm getting this same error. The first time I tried to access the folder with the .htaccess file as it is on the live server I have running, I checked the logs, which said:

[Sun Dec 02 09:12:51 2007] [alert] [client 127.0.0.1] C:/xampp/htdocs/phplearningneeds/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration

Now, I know that RewriteEngine is valid since it works on my live server. Well, I took out that line and got this error:

[Sun Dec 02 09:15:52 2007] [alert] [client 127.0.0.1] C:/xampp/htdocs/phplearningneeds/.htaccess: Invalid command 'RewriteRule', perhaps misspelled or defined by a module not included in the server configuration

How can RewriteRule be an invalid command? Well, I took out that line and got this:

[Sun Dec 02 09:18:46 2007] [alert] [client 127.0.0.1] C:/xampp/htdocs/phplearningneeds/.htaccess: Invalid command 'RewriteCond', perhaps misspelled or defined by a module not included in the server configuration

Now, I also know that RewriteCond is valid, because it shows up in jungle green in my editor.

So I took out all my RewriteCond (aka bot forbidding) lines, and now it sort of works. The thing is, in addition to my bot prevention lines, my security requires:

RewriteEngine On
RewriteRule .* index.php [NC,L]

How do I fix this issue?
KallistaAEnvarou
 
Posts: 126
Joined: 02. December 2007 17:33
Location: Cold Cold California

Postby Izzy » 02. December 2007 18:34

Yours is a different error as indicated by defined by a module not included in the server configuration in the error.log.

Open xampp\apache\conf\httpd.conf file in your text editor and find this line:
#LoadModule rewrite_module modules/mod_rewrite.so

Uncomment it like so:
LoadModule rewrite_module modules/mod_rewrite.so

Save the file and then restart Apache.

Always make a backup of any .conf or .ini file before editing in case you make a typo which prevents Apache from restarting - all you need do then is revert to the original backup.


===========================================
1. The new DeskTopXampp Launch Control for XAMPP / XAMPPlite
Posted by Ridgewood available from Ridgewood'sDTX web site

2. Build Rich AJAX Applications - Faster
TIBCO General Interface Pro Edition but FREE and Open Source
Fully working with NO donations required to get a user/password
===========================================
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Postby KallistaAEnvarou » 02. December 2007 20:23

Thanks! That worked!
KallistaAEnvarou
 
Posts: 126
Joined: 02. December 2007 17:33
Location: Cold Cold California


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 64 guests

cron