Page 1 of 1

[SOLVED] Grrr! Can't even get started with mod_rewrite!

Posted: Mon Mar 13, 2006 10:09 am
by Skittlewidth
Just spent an hour browsing through the plentiful posts here on mod_rewrite, googled for tutorials, read some of the Apache manual, but still no joy.

I want to do some mod_rewrite testing on my local machine running Apache 1.3 and windows.
I've gone into the httpd.conf, uncommented the LoadModule rewrite_module modules/mod_rewrite.so line and the AddModule mod_rewrite.c line, rebooted Apache, even rebooted my machine and it still doesn't appear to have loaded, as the following simple code in an .htaccess file is not working.

Code: Select all

RewriteEngine On
RewriteRule ^test1.html$ test2.html [R=301]
I've tried it on the root, I've tried it in a sub folder, and it always shows the text on test1.html, so I'm guessing mod_rewrite isn't running. Any ideas why? I've had a look through my phpinfo and find no reference to it there either, but not sure which section it appears in. :evil:

Posted: Mon Mar 13, 2006 11:26 am
by feyd

Code: Select all

RewriteEngine On
RewriteRule ^/test1.html$ test2.html [R=301]
:?:

Posted: Tue Mar 14, 2006 3:08 am
by Skittlewidth
Nope, didn't work. I ran one of my test files on a web server and it did what I expected so I know the .htaccess file was correct. Mod_rewrite is definately not loading. It's not appearing in the phpinfo and I've checked for possible duplication of the httpd.conf file.

The file mod_rewrite.so is in the modules directory as expected. I can't find mod_rewrite.c anywhere but then I can't find any other "files.c" either.

Do you think its worth me upgrading to Apache 2 and seeing if I can get it to work with that? I thought this was meant to be the simple bit!

EDIT: It was the allowoveride settings in the conf file and a browser caching problem that was playing up. I'm surprised none of the tutorials I saw mentioned changing the allowoveride settings, as of course it won't work otherwise.

Posted: Tue Mar 14, 2006 2:27 pm
by timvw
The windows version of .so files are .dll files... Thus you need to load a mod_rewrite.dll...

And it won't show up in your phpinfo page because it's apache related and not php...

Posted: Wed Mar 15, 2006 3:16 am
by Skittlewidth
Ah, ok, I was just following advice from this tutorial at
http://www.workingwith.me.uk/articles/s ... od_rewrite

For the purpose of this article, I’m going to assume that you don’t have access to view or edit the Apache server httpd.conf file, so the easiest way to check whether the mod_rewrite module is installed will be to look on your phpinfo page. If you’ve not already created one of these for yourself, just copy and paste the following code into an new text file using your favourite text editor, save it as phpinfo.php, and upload it to your server:

<?php phpinfo(); ?>Load that page up in your web browser, and perform a search for “mod_rewrite”. All being well, you’ll find it in the “Apache loaded modules” section of the page.
It is working now anyway, and as you say, it doesn't show up in phpinfo();