I'm new to creating .htaccess files. Is there a recommeneded max size or no. of lines? Would a file with, say 5000 lines have a noticeable effect on performance? If so, would this be adequately countered by upgrading from a shared to a dedicated server?
Try it, see what happens Bu yes it can degrade performance of your site. I would think that it's pretty difficult to say and would depend on what exactly you've got in there. Only one sure way to find out
OK: RewriteEngine on RewriteRule magicians/act-name /profile.php?id=1 RewriteRule magicians/act-name /profile.php?id=2 RewriteRule comedians/act-name /profile.php?id=3 RewriteRule hypnotists/act-name /profile.php?id=4 RewriteRule bands/jazz-bands/act-name profile.php?id=5 RewriteRule bands/jazz-bands/act-name profile.php?id=6 RewriteRule bands/reggae-bands/act-name profile.php?id=7 All the 'act-name's wouls be unique. Only 'bands' wouls have an additional subcat. profile.php pulls all data (including cat, sub-cat and act-name) from a mysql db. I think I could write a script to automatically generate an .htaccess file in the above format. I wouldn't have a clue how you would reduce this down but if you've got any ideas...... I know there's regular expressions, but it's rocket science to me.
If you're not using any other URL rewriting (other than to go to the profile.php script), you could set it up so that for every request where a real file of that name does not exist gets rewritten to the profile.php script. You can then edit your profile.php to parse the URL and lookup the corresponding profile. Alternatively you could keep the ID itself in the generated URLs so that they would be in the format cat/subcat(optional)/id/name - and that would only need one rewrite rule. RewriteCond %{SCRIPT_FILENAME} !-f RewriteCond %{SCRIPT_FILENAME} !-d RewriteRule ^[^/]+/([^/]+/)?([0-9]+)/[^/]+$ /profile.php?id=$2 [L] First two lines just check if the requested file exists and stops rewriting if it does.
Thanks for your reply rodney88. I noticed from your glype.com site you offer a paid mod_rewrite service. My site is still in the development stage, but I'd like to contact you in a month or 2 for a quote to look at the best solution to this, if that's ok.