views:

34

answers:

1

Hello,

I am trying to re-write this:

http://www.domain.com/sample/comments/68

Into this:

http://www.domain.com/sample/comments/index.php?submissionid=68

Here is what the .htaccess file looks like in both the directory represented by "sample" above and the directory "comments":

RewriteEngine on
RewriteRule ^comments/([0-9]+)?$ index.php?submissionid=$1 [NC,L]

The first URL (http://www.domain.com/sample/comments/68) goes to a 404 error. I have checked, and mod_rewrite appears to be enabled. Also, when I manually enter the second URL, the correct page pulls up.

Any idea why my the URL re-write is not working?

Thanks in advance,

John

A: 

Using your .htaccess file in your comments directory, try the following:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([0-9]+)?$ index.php?submissionid=$1 [NC,L]

And unless you need it, I'd just get rid of the .htaccess file in your sample directory. If you get any sort of error, and you have access to your server's error logs (I forget if you mentioned whether or not you do already), please post the last few entries of those as it will help us diagnose where things might be going wrong.

Tim Stone
Okay, thanks. I tried it and it still didn't work. But I appreciate your help. I just called my hosting company and they told me how to enable the error logs. I won't have access to them for about a day.
John
Oh, weird..Hm. Alright, well, once you're able to get the logs, please edit this (or one of your other questions) to include that information, and hopefully at that point I or someone else will have an answer for you that'll work.
Tim Stone