NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
mod_rewrite


Joined: 17 May 2005
Posts: 12
Reply with quote
(edited after reformulating the problem)

hi, Im trying to install the Cake php framework, and it needs mod_rewrite on to work. I uncommented
Code:
LoadModule rewrite_module modules/mod_rewrite.so

and
Code:
AddModule mod_rewrite.c

and have
Code:
RewriteEngine on
at the .htaccess files.

but so far it doesnt seem to work... when pointing to the install root directory, I only get a 404. I don´t think there´s anything wrong with the install... am I missing something with the mod_rewrite config? is there something specific to the TechPlat install or to apache on windows?

tia
oliver


Last edited by oliverazevedobarnes on Sat May 28, 2005 8:38 pm; edited 1 time in total
View user's profileFind all posts by oliverazevedobarnesSend private message
dll not needed?


Joined: 17 May 2005
Posts: 12
Reply with quote
after doing some more research, i figured I don´t need a dll for this... is this correct? mod_rewrite.so would be the right one then... if so, I´m at a loss of how to make it work, could you help me out please. I dont know much about apache config
tia
View user's profileFind all posts by oliverazevedobarnesSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 7893
Reply with quote
What you shown above looks correct and should work.
You may want to enabled mod_rewrite's logging and inspect the logged lines to see what's wrong.
AFAIK in most cases users tend to write incorrect rules.
Try the simpliest ones listed in the docs and see if they work, they try complicated rules etc.
Don't forget to restart Apache (or reload its configs) each time you change anything in configuration files.
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 29 Sep 2004
Posts: 62
Reply with quote
I've also been having problems with mod_rewrite using the Tech Platform (not sure which version, uses php ver 4.3.4). I have an .htaccess which works on a test site on my Linux production server but not on the same test site on my local Win2000 server. I uncommented all related mod_rewrite statements in apache/conf/httpd.conf and tried my .htaccess, but keep getting a 404 when trying the test url (after stopping/starting apache). I then added the rewrite logging in httpd.conf as you suggested to oliverazevedobarnes with:

RewriteLog logs/rewrite.log
RewriteLogLevel 9

On starting apache I get:

Syntax error on line 72 of c:/nusphere/apache/conf/httpd.conf:
Invalid command 'RewriteLog', perhaps mis-spelled or defined by a module not included in the server configuration

The syntax for RewriteLog comes from the apache site (http://httpd.apache.org/docs/2.1/mod/mod_rewrite.html). I don't get any startup errors when mod_rewrite is uncommented, but I do when I add the 'RewriteLog'. What am I doing wrong, and how do I get mod_rewrite working on my local machine? How do I check if my local Tech Platform apache supports mod_rewrite?

My .htaccess looks like:
Options +FollowSymLinks
RewriteEngine on
RewriteRule g(.*)\.html$ /go.php?gid=$1

One thing I noticed is that my online phpinfo shows mod_rewrite under the Loaded Modules section in the apache block, but for my local machine there is no Loaded Modules section, and under PHPEd there isn't even an apache block, never mind a Loaded Modules section. How do I figure what's going on with apache in phpinfo in these two local environments? PHPEd is ver 4.0 build 4037 (I presume it uses the same apache as the Tech Platform?).
View user's profileFind all posts by pointySend private message
Site Admin

Joined: 13 Jul 2003
Posts: 7893
Reply with quote
first of all, if you have Virtual Hosts in your Apache configuration (and TechPlatform installs Virtual hosts by default) you have to turn
RewriteEngine on for each Virtual host you want it to work under:

For example, find
<VirtualHost.......
then add the following line under it
RewriteEngine on
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 29 Sep 2004
Posts: 62
Reply with quote
Thanks - that worked perfectly. Even the rewrite log is working once I added it to each virtual host section after the "RewriteEngine on" line.
View user's profileFind all posts by pointySend private message


Joined: 29 Sep 2004
Posts: 62
Reply with quote
I rejoiced too soon. It works perfectly with just the tech platform, but no matter what I do I can't get it to work with PhpED debugger - I just get a 404 each time using what I've already tested successfully with the tech platform. I noticed PhpED debugger uses port 8080, so I created an extra virtual host entry in apache.conf for 8080 based on the example for port 80:

<VirtualHost *:8080>
#
# for mod_rewrite
#
RewriteEngine on
RewriteLog logs/rewrite.log
RewriteLogLevel 9

ErrorLog logs/port8080.log
CustomLog logs/common-access.log common
</VirtualHost>

I made sure logging is set on in PhpED's php.ini but regardless, it doesn't write anything to the logs.

I searched for another apache.conf, thinking maybe it uses its own apache same as it uses its own php, but found nothing. I know I have to start apache in order to use MySQL, but does PhpED use the tech platform's apache as its webserver, or does it use something else as a webserver? How do I activate mod_rewrite for PhpED debugging?
View user's profileFind all posts by pointySend private message
mod_rewrite
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic