Forum Moderators: phranque

Message Too Old, No Replies

Specific mod_rewrite question

         

scott17

6:13 pm on Sep 19, 2005 (gmt 0)



We are trying to get a link that looks like this:

www.domain.com/directory1/file1.php

to point to:

www.domain.com/directory1/index.php?file=file1

To start, we created a .htaccess file inside of directory1 (the mod_rewrite module is loaded into apache).

The file looks like this:
=======
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
#RewriteBase /directory1/
#RewriteCond %{REQUEST_FILENAME}!-s
#RewriteRule directory1/([a-z]+)\.php$ [domain.com...]
#RewriteRule directory1/([^.][a-z]+)\.php$ [domain.com...] [L]
RewriteRule ^([^/]+)/([^.]+)\.php$ directory1/index.php?file=$2 [L]
</IfModule>
=======

The commented out lines are various rules we've tried with and failed. When attempting to access www.domain.com/direcotory/file1.php it simple responds with a 404 saying file1.php is not found.

This is our first attempt at using mod_rewrite so any help would be appreciated.

Thank you.

jdMorgan

9:44 pm on Sep 19, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



scott17,

Welcome to WebmasterWorld!

Check your server error log for some potentially-very-useful information.

Jim