Apache Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsSystem AdministrationApache Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 29th, 2001, 07:17 PM
erdincyilmazel erdincyilmazel is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2001
Location: Turkey
Posts: 6 erdincyilmazel User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy mod_rewrite on windows

Hi,
I'm trying to use mod_rewrite module for apache on windows 2k.

On httpd.conf I removed the # sign at the begining of the line that loads the module,

and I tried many rewrite rules that I collected from the net, but none of them worked.... I'm sure that rewrite module isn't working properly... What should I do to run it ?

For instance the following lines didn't work :
RewriteEngine on
RewriteRule ^/articles/(.*) /articles?rest_of_url=/$1

or;

RewriteRule ^story/(.*)$ stories.php?story=$1

Thanx

Reply With Quote
  #2  
Old August 29th, 2001, 09:20 PM
freebsd freebsd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 5 freebsd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
>> RewriteRule ^/articles/(.*) /articles?rest_of_url=/$1

>> or; RewriteRule ^story/(.*)$ stories.php?story=$1

When you are doing internal redirection, you should give absolute file system path to your script by putting / first. Your /articles tells Apache your articles resides in your root directory (ex. C:\articles) which obviously not where it is. In your 2nd rule, you didn't specify the file system path, so that assumes to be the current directory of your story directory. It's also a good practice to tell Apache what kind of handler stories.php is. That's to put [T=application/x-httpd-php].

Anyhow, do a search in this forum for your answer as your case has been discussed million times here.

Reply With Quote
  #3  
Old August 30th, 2001, 05:30 AM
erdincyilmazel erdincyilmazel is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2001
Location: Turkey
Posts: 6 erdincyilmazel User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Post I searched the forums many times

Hi,
Thanks for your reply, I searched this forum and found many answers for my problems, but I couldn't make it work so I posted here.

Actually I'm trying to run the following lines, but I tried the others to test the rewrite module...

Here is some code that I copied from a post that you have sent before :

# enabling mod_rewrite
RewriteEngine on
# for request of http://linux.localhost/ or http://linux.localhost or http://linux.localhost/index.php
RewriteCond %{REQUEST_URI} ^/index\.php.*
# do not continue and last it
RewriteRule ^(.+) - [L]
# if request is anything else
RewriteCond %{REQUEST_URI} ^/(.*)$
# check and see if the pattern matches
# http://linux.localhost/foo -> matches and $QUERY_STRING returns group=foo§ion=category=
# http://linux.localhost/foo/bar -> matches and $QUERY_STRING returns group=foo§ion=bar&category=
# http://linux.localhost/foo/bar/ha -> matches and $QUERY_STRING returns group=foo&section=bar&category=ha
RewriteRule ^([A-Za-z0-9]+)/?([A-Za-z0-9]*)/?([A-Za-z0-9]*)$ index.php?group=$1\§ion=$2\&category=$3 [T=application/x-httpd-php,L]

Neighter this nor the others work on my sytem....

Reply With Quote
  #4  
Old August 30th, 2001, 10:41 AM
piet piet is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2001
Location: Bend, OR
Posts: 96 piet User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
erdincyilmazel:

What kind of errors are you getting? Have you restarted apache? Have you loaded the rewrite module? When you restart apache with your rewrite engine "on" do you get any errors?

Let me know. I am running Apache/PHP/MySql on Win2k with no problem and I use many rewrite rules.

Piet
__________________

- Please help us build our Hewlett Packard community
- Check us out, or tell someone who might find us useful

Last edited by piet : April 7th, 2003 at 03:38 PM.

Reply With Quote
  #5  
Old August 30th, 2001, 11:04 AM
erdincyilmazel erdincyilmazel is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2001
Location: Turkey
Posts: 6 erdincyilmazel User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I sometimes ged bad request errors at the browsers, and the other errors are everytime 404 errors. I placed the code that I pasted below in my httpd.conf file or in a .htaccess file.. nothing changed.
When I try to access http://localhost/foo/foo2 or something like that, I get 404 errors... Apache runs without an error.. It loads the module I think... I restarted the apache service dozens of times... I didn't istall php as an apache module.. I'm using it in cgi mode..

If it will help I can post my httpd.conf file...

Piet can you send me any code that works well on your system ?
or can you contact me by emai icq etc. ?

Thanks a lot...
jam@pearljam.org

Reply With Quote
  #6  
Old August 30th, 2001, 12:16 PM
piet piet is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2001
Location: Bend, OR
Posts: 96 piet User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
erdincyilmazel (what is that anyways?):

Let's keep posting here on the forum for the meantime so that others who come across this problem can fix it too.


First off, you can start by reading this thread. Here you will see some code to put into your httpd.conf file.

http://forums.devshed.com/showthrea...9986&forumid=15

Second. After looking at my httpd.conf file the only thing different that I have is the that I surrounded my Rewrite Rules in <Directory "/path/to/index.php folder (not the actual file)"></Directory> tags. Have you done this? Make sure your path is in quotes. In addition, make sure your DocumentRoot "/root/" is correct and that it matches the <Directory> path. So for example, if your DocumentRoot is "/apache/webroot" then your Directory should be <Directory "/apache/webroot">. The script that is parsing the URL, index.php, should sit in the "webroot" folder.

Let me know if this helps.

You are welcome to post your httpd.conf file but please remove the # comments.

Piet

Last edited by piet : April 7th, 2003 at 03:39 PM.

Reply With Quote
  #7  
Old August 31st, 2001, 04:00 AM
erdincyilmazel erdincyilmazel is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2001
Location: Turkey
Posts: 6 erdincyilmazel User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I finally solved my problems...
As you said I placed the code between
<Directory "C:\Apache\htdocs">
</Directory> tags...

then I received Bad Request Errors from the browser, but then I changed the line :
RewriteRule ^([A-Za-z0-9]+)/?([A-Za-z0-9]*)/?([A-Za-z0-9]*)$ index.php?group=$1\§ion=$2\&category=$3 [T=application/x-httpd-php,L]

and added a / infront of index.php so it worked...

I finally understood the basics of mod_rewrite...
Thank you all for your helps.

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationApache Development > mod_rewrite on windows


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway