mod_rewrite - not working?

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

mod_rewrite - not working?

Postby imvain2 » 22. March 2007 02:07

Ok, I'm new to xampp and mod_rewrite. Is there somewhere that I have to "allow" mod_rewrite?

Here is what I have for the htaccess file within the htdocs/forbidden:

RewriteEngine on
RewriteRule ^cities/(.*) cities.php?State=$1 [nc]

what I want to do is for the link: www.Anydomain.com/cities/Maine would be accessing: www.AnyDomain.com/cities.php?State=Maine
imvain2
 
Posts: 9
Joined: 22. March 2007 02:01

Postby Wiedmann » 22. March 2007 02:22

What's the problem? You have an error or an unwanted behaviour?

(BTW: Your rule looks good)
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby imvain2 » 22. March 2007 02:46

ooopsss sorry.

I receive the following error.

Object not found!

The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.

If you think this is a server error, please contact the webmaster.
Error 404
localhost
03/21/07 20:45:31
Apache/2.2.4 (Win32) DAV/2 mod_ssl/2.2.4 OpenSSL/0.9.8d mod_autoindex_color PHP/5.2.1
------------------------------

Stupid question.

I know I need to have cities.php, but do I need an empty folder or file extension-less file named cities?
imvain2
 
Posts: 9
Joined: 22. March 2007 02:01

Postby Wiedmann » 22. March 2007 03:13

Here is what I have for the htaccess file within the htdocs/forbidden:

Sorry, I have not seen this before... But why is your ".haccess" file in the directory "htdocs/forbidden"?

www.Anydomain.com/cities/Maine

With this URI you only access "htdocs".
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby imvain2 » 22. March 2007 03:36

Wiedmann wrote:
Here is what I have for the htaccess file within the htdocs/forbidden:

Sorry, I have not seen this before... But why is your ".haccess" file in the directory "htdocs/forbidden"?

After I copied all the files from the Zip and ran the installation batch file, I did a search and found three htaccess files located in:

1). htdocs/forbidden
2). phpmyadmin/libraries
3). htdocs/xampp/sqlite

www.Anydomain.com/cities/Maine

With this URI you only access "htdocs".


Currently I have a folder in htdocs called domains, within that folder is where my cities.php code exists.
imvain2
 
Posts: 9
Joined: 22. March 2007 02:01

Postby Wiedmann » 22. March 2007 14:21

Let me say it in other words:
what I want to do is for the link: www.Anydomain.com/cities/Maine would be accessing: www.AnyDomain.com/cities.php?State=Maine

With this URI the files "cities.php" and ".htaccess" must be in the DocumentRoot from the server (or vhost) "www.Anydomain.com".
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby imvain2 » 22. March 2007 19:38

thanks for your help.

When I put the htaccess file with the contents above, into the root folder for the website along with the cities.php file, I get a new error:

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
03/22/07 13:36:03
Apache/2.2.4 (Win32) DAV/2 mod_ssl/2.2.4 OpenSSL/0.9.8d mod_autoindex_color PHP/5.2.1

---------------------------------------------------------
When I remove the htaccess file, the index.php runs fine. Either way hte htaccess isn't working correctly.

Thanks again for all of your help
imvain2
 
Posts: 9
Joined: 22. March 2007 02:01

Postby Wiedmann » 22. March 2007 20:06

Error 500

Read the "error.log" of your webserver.

You know:
If you think this is a server error, please contact the webmaster.

You are the webmaster ;-)
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby imvain2 » 23. March 2007 00:07

Wiedmann wrote:Read the "error.log" of your webserver.


That's funny, before I read this post, I went in and read my error.log and found the below error:

Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration

Wiedmann wrote:You know:
You are the webmaster ;-)


I know, my email conversations were started to get really confusing, everytime I emailed me self a problem, and I responded back with I don't know. :?
imvain2
 
Posts: 9
Joined: 22. March 2007 02:01

Postby imvain2 » 23. March 2007 00:15

After researching the error, I believe I have made progress. That error specifically was because the mod_rewrite was commented out in the httd file. So I removed the # and re ran the just my index.php and received a new error, checked the error log and received this error: E:/xampp/htdocs/cities.

So, now I believe is time to go into detail about what I have setup.

I obviously have Xampp installed in e:/xampp.

Within the E:/xampp/htdocs/domains folder, I have my htaccess file with the contents of:

RewriteEngine on
RewriteRule ^cities/(.*) cities.php?State=$1 [nc]
imvain2
 
Posts: 9
Joined: 22. March 2007 02:01

Postby Wiedmann » 23. March 2007 00:15

That's funny, before I read this post, I went in and read my error.log and found the below error:

So your problem is solved?
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby imvain2 » 23. March 2007 00:25

Actually I just figured a solution. I didn't realize that I had to have an empty file/folder named cities, in the root folder of htdocs. You did say that cities.php and htaccess had to be in the website's root folder, but I didn't think about the empty cities file.

Its all good, its working now.

Thanks for all of your help.
imvain2
 
Posts: 9
Joined: 22. March 2007 02:01

Postby Wiedmann » 23. March 2007 00:37

but I didn't think about the empty cities file.

What does you mean with an "empty cities file".


Its all good, its working now.

I don't think so. I think it only seems to work...
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby imvain2 » 23. March 2007 01:00

I created an empty text file with no extension in htdocs file and named it cities, I tried a folder and left it empty and that "worked" also.
imvain2
 
Posts: 9
Joined: 22. March 2007 02:01

Postby Wiedmann » 23. March 2007 01:05

I created an empty text file with no extension in htdocs file and named it cities

Well, whatever you are doing now, it's not correct...

(BTW: "htdocs" is a directory an not a file)
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Next

Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 49 guests