Forum Moderators: phranque

Message Too Old, No Replies

RewriteMap help

htaccess

         

strazdinjsh

9:41 am on Jul 25, 2011 (gmt 0)

10+ Year Member



Hello.

I am web developer newbie who creates the php class who converts the ugly look of the url to the friendly one. Result of the usage of this class is friendly url output and generated htaccess file with rules and conditions for particular urls.

Sample: I have some url who looks as follows:
index.php?a=1&b=2&c=3
, where any of these variables can have value {numbers, letters}. Variables values are collected from database tables.


a=1 => webtest_1
a=2 => webtest_2
...
a=x => webtest_x
-------------------------------
b=1 => photo_1
b=2 => photo_2
...
b=x => photo_x
--------------------------------
c=1 => pc_1
c=2 => pc_2
...
c=x => pc_x
--------------------------------
...
...
...
--------------------------------
z=1n => last_variable_1n
z=2n => last_variable_1n
...
z=xn => last_variable_xn



So, my htaccess contains something like:

Options +FollowSymlinks
RewriteEngine on

RewriteRule ^webtest_1/photo_2/pc_3\.html$ /index.php?a=1&b=2&c=3 [L]
RewriteRule ^webtest_2/photo_1/pc_1\.html$ /index.php?a=2&b=1&c=1 [L]
...
...
...


I have been done with this class so far - i am able to use it, only one disadvantage - lack of knowledge in htaccess coding. The htaccess file is huge and depends on the number of variables selected in url and number of rows assigned from the DB tables. I am looking for option to optimize it and speed up the loading of the web.

Could anyone advice and might be show how to use RewriteMap for my case. I have read a lot but have not got a solution for it.

Thank you in advance.