Forum Moderators: phranque

Message Too Old, No Replies

pattern help for url rewriting

         

fastcreators

9:44 am on Aug 15, 2005 (gmt 0)



i have a database driven site that generates links like
www.domain.com/index.php?linkname=toys&maincat=games
i want to use mod rewrite for using URLs like
www.domain.com/toys/games

i have written the following expression in .htaccess
RewriteRule ^www.domain.com/[a-z]/[a-z]$ index.php?linkname=$1&maincat=$2

but when i use URL like www.domain.com/toys/games it gives me 500 internal server error, any suggestions in this regard are highly appreciated. thanks

dcrombie

12:50 pm on Aug 15, 2005 (gmt 0)



What you need is something more like this: (untested)

RewriteRule ^([a-z]+)/([a-z]+)$ /index.php?linkname=$1&maincat=$2

The RewriteRule only applies to the 'path' component of the URI - not the domain name. The domain name, query string, etc can be processed using RewriteCond directives before the RewriteRule.

fastcreators

6:42 pm on Aug 15, 2005 (gmt 0)



[localhost...]

i tried this URL with your suggested pattern but it gives 500 Internal Server error.though if i use URL like
[localhost...] it does show me the desired page, but with [localhost...] this its not working please share any wise words in this regard

jdMorgan

10:08 pm on Aug 15, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



> 500 Internal Server error

Perhaps some wise words would be: Check your server error log when you get an error... ;)

Jim

fastcreators

3:50 am on Aug 17, 2005 (gmt 0)



hi friends
i have finally fixed the problem infact i was using wrong pattern for static URLs and now i have fixed that thanks for so rapid and informative replies, this forum is simple the best