htaccess Elite

.htaccess tutorial


All times are UTC [ DST ]





Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: mod_rewrite Efficiency Question
PostPosted: Oct 2nd, '06, 01:58 
Offline
User avatar

Joined: Sep 25th, '06, 04:48
Posts: 242
Hey I am one of those people that hasn't taken the time to learn the rewrite regex rules. So I can manage but I cringe because I know it could be done better.

My question should be pretty easy for you guys-

Current htaccess Rewrites
Code:
1. RewriteRule ^ic/(.*) includes/css/$1 2.
RewriteRule ^ij/(.*) includes/javascript/$1 3.
RewriteRule ^ii/(.*) includes/images/$1 4.
RewriteRule ^is/(.*) includes/swf/$1 5.
RewriteRule ^po/i/(.*) products/individual/$1 6.
RewriteRule ^po/b/(.*) products/business/$1 7.
RewriteRule ^po/(.*) products/$1 8.
RewriteRule ^scripts/(.*)\.pl$ /cgi-bin/$1.php


Notice how #7 seems to be redundant or something? Shouldn't I be able to move #7 above 5 and 6 and shorten the code?



This enables me to have a verbose file structure so maintaining the site is easy and clear. But to make my XHTML cleaner and simpler and smaller (bytes) I reference files like so-
Code:


products/ po/
products/business/ po/b/
products/individual/ po/i/
includes/css/ ic/
includes/javascript/ ij/
includes/images/ ii/
includes/swf/ is/





Before I used poi/ and pob/ but I changed that to make my applications like breadcrumbs, php, etc work more logically.

This isn't a crucial thing that I need right now, I more want to learn and discuss the best-practices way of rewrites for this particular use. Please help me out! Peace out


Last edited by produke on Nov 1st, '06, 09:29, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Oct 2nd, '06, 01:59 
Offline
User avatar

Joined: Sep 25th, '06, 04:48
Posts: 242
One solution provided by extras is to use symlinks

Code:
<?php
# NAMED test.php in my /htdocs folder on the new server platform
echo '<pre>';


echo `ln -sv includes/axs ia 2>&1`;
echo `ln -sv includes/css ic 2>&1`;
echo `ln -sv includes/images ii 2>&1`;
echo `ln -sv includes/javascript ij 2>&1`;


echo '</pre>';
?>


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 12 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB