Forum Moderators: phranque

Message Too Old, No Replies

Dynamic to Static

         

Moff

2:04 pm on Jan 21, 2004 (gmt 0)

10+ Year Member



Hi I have never really played around with Mod rewrites before but after looking around here I thought I'd give it a go. Basically what I want to do is change the ugly url on a search script to something that blends in with the site a bit better. This is what I came up with in my .htaccess file of the root directory:


Options +FollowSymLinks
rewriteEngine on
rewriteRule ^widgets\.shtml$ /cgi-bin/perlfect/search/search.pl?&q=widgets [R=301,L]

This gives me a internal server error(500) when requesting any page on the site.
It also gives me the following in my error.log file.

/home/widgets/htdocs/.htaccess: Invalid command 'rewriteRule', perhaps mis-spelled or defined by a module not included in the server configuration
/home/widgets/htdocs/.htaccess: Invalid command 'rewriteEngine', perhaps mis-spelled or defined by a module not included in the server configuration

Does this mean that Rewrite is not installed on my server or it there something wrong with my code? Is there any other way to get the same effect if it is my server?

Thanks for any help

Birdman

2:16 pm on Jan 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It sounds like you don't have mod_rewrite loaded.

If it's your server, open the httpd.conf file and look for these lines:

#LoadModule rewrite_module modules/mod_rewrite.so
#AddModule mod_rewrite.c

If you see them, simply remove the # from the beginning and then save the file. If you don't see them, put them in there, without the #, of course.

You will need to restart Apache for the change to take place.

Disclaimer Back the file up beforehand, just in case. I'm not the Apache guru.

Moff

2:26 pm on Jan 21, 2004 (gmt 0)

10+ Year Member



Thanks,

Thats what I thought it sounded like, it is our server but unfortunatly dont have admin access so will have to wait for now. Is mod_rewrite the only way to achieve this effect?

Moff

jdMorgan

6:16 pm on Jan 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Moff,

Welcome to WebmasterWorld [webmasterworld.com]!

Try the Redirect and RedirectMatch directives of Apache mod_alias [httpd.apache.org].

Jim