Forum Moderators: phranque

Message Too Old, No Replies

Another Mod Rewrite question

         

harryhermit

9:39 am on Feb 13, 2004 (gmt 0)

10+ Year Member



Ok, I've seriously tried to get this to work for a couples of hours. I thought I knew how it worked since I've successfully got a few rules to work, but this last one I just can't get it right. I've searched the forums and did numerous searches, but I really don't know what answers to search for cuz by my understanding it should work. Anyhow, I'm simply trying to do a rewrite like this:

from: www.mydomain.com/brand.php?brand=brandname
to: www.mydomain.com/brands/brandname.html

One of the things I tried:

rewriteEngine on
rewriteRule ^brands/(.*)\.html$ /brand.php?brand=$1 [T=application/x-httpd-cgi,L]

and that won't work, but this will:

rewriteEngine on
rewriteRule ^(.*)\.html$ /brand.php?brand=$1 [T=application/x-httpd-cgi,L]

I wrote a similar rule but "$1" accepted an integer rather than characters. Is that my problem? If so, why does the second code I wrote work?

harryhermit

5:41 pm on Feb 13, 2004 (gmt 0)

10+ Year Member



Sorry, I think this is in the wrong forum. Mod please move to Apache web server. Thanks

jdMorgan

12:55 am on Feb 14, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Good question!

Is this code located in httpd.conf or in .htaccess? If in .htaccess, where is it located, in your web root or in a subdirectory?

The code should work in .htaccess in web root, unless your getting a rewrite loop.

Check your server error log to see if there is any indication of a problem.

Jim

harryhermit

2:28 am on Feb 14, 2004 (gmt 0)

10+ Year Member



Its in .htaccess and that is located in my root. I have other rules that work perfectly fine. My error logs don't come up with anything out of the ordinary either.

This also works for some strange reason:

RewriteRule brands/(.*)/$ /brand.php?brand=$1 [T=application/x-httpd-cgi,L]

outputting www.mydomain.com/brands/brandname/

I don't really need it, but its annoying me not knowing why everything works accept that one.